\r
\r
//----------------------------------------------------------------------------\r
-bool vvSlicerManager::SetFusion(std::string filename,int dim, std::string component)\r
+bool vvSlicerManager::SetFusion(std::vector<std::string> filenames,int dim, std::string component, vvImageReader::LoadedImageType type)\r
{\r
- mFusionName = filename;\r
+ mFusionName = filenames[0];\r
mFusionComponent = component;\r
if (dim > mImage->GetNumberOfDimensions()) {\r
- mLastError = " Overlay dimension cannot be greater then reference image!";\r
+ mLastError = " Fusion dimension cannot be greater than reference image!";\r
return false;\r
}\r
if (mFusionReader.IsNull())\r
mFusionReader = vvImageReader::New();\r
- std::vector<std::string> filenames;\r
- filenames.push_back(filename);\r
mFusionReader->SetInputFilenames(filenames);\r
- mFusionReader->Update(mImage->GetNumberOfDimensions(),component.c_str(),mType);\r
+ mFusionReader->Update(type);\r
if (mFusionReader->GetLastError().size() == 0) {\r
for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
mSlicers[i]->SetFusion(mFusionReader->GetOutput());\r
}\r
\r
//adjust the time slider in the overlay panel\r
- mFusionSequenceNbFrames = mFusionSequenceReader->GetOutput()->GetTransform().size()-1; //actually, this is the maximum index...\r
+ mFusionSequenceNbFrames = mFusionSequenceReader->GetOutput()->GetTransform().size(); \r
mFusionSequenceFrameIndex = std::max<int>( 0, std::min<int>(mFusionSequenceFrameIndex, mFusionSequenceNbFrames));\r
\r
return true;\r
//the secondary sequence is being reloaded.\r
void vvSlicerManager::ReloadFusionSequence()\r
{\r
+ // this is to keep the slice thickness, which needs to be artificially increased for visualization\r
+ double sp_x, sp_y, sp_z;\r
+ this->GetImage()->GetVTKImages()[0]->GetSpacing(sp_x, sp_y, sp_z);\r
+\r
mFusionSequenceReader->Update(mImage->GetNumberOfDimensions(),mFusionComponent.c_str(),vvImageReader::MERGEDWITHTIME);\r
\r
for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
this->AddFusionSequenceInitialTransformMatrices( mFusionSequenceReader->GetOutput()->GetTransform()[i]->GetMatrix() );\r
}\r
\r
+ // also update the slice thickness\r
+ for (unsigned i=0 ; i<this->GetImage()->GetTransform().size() ; i++) {\r
+ sp_x = this->GetImage()->GetVTKImages()[i]->GetSpacing()[0];\r
+ sp_y = this->GetImage()->GetVTKImages()[i]->GetSpacing()[1];\r
+ this->GetImage()->GetVTKImages()[i]->SetSpacing( sp_x, sp_y, sp_z);\r
+ }\r
+\r
}\r
//----------------------------------------------------------------------------\r
\r