X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvSlicerManager.cxx;h=89fd42b49fae4177e89ec0c2ee4590e38c9a6f54;hb=9c5f0e4d3d6b33e09d0413439ed7a867e3d85faa;hp=e975da28babd5ee04bdb31120ccd77bd50b5412f;hpb=e2d2096e1a3a4afdad6446bf09d0e05f47d9b7eb;p=clitk.git diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index e975da2..89fd42b 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -279,20 +279,18 @@ bool vvSlicerManager::SetOverlay(std::vector filenames,int dim, std //---------------------------------------------------------------------------- -bool vvSlicerManager::SetFusion(std::string filename,int dim, std::string component) +bool vvSlicerManager::SetFusion(std::vector filenames,int dim, std::string component, vvImageReader::LoadedImageType type) { - mFusionName = filename; + mFusionName = filenames[0]; mFusionComponent = component; if (dim > mImage->GetNumberOfDimensions()) { - mLastError = " Overlay dimension cannot be greater then reference image!"; + mLastError = " Fusion dimension cannot be greater than reference image!"; return false; } if (mFusionReader.IsNull()) mFusionReader = vvImageReader::New(); - std::vector filenames; - filenames.push_back(filename); mFusionReader->SetInputFilenames(filenames); - mFusionReader->Update(mImage->GetNumberOfDimensions(),component.c_str(),mType); + mFusionReader->Update(type); if (mFusionReader->GetLastError().size() == 0) { for ( unsigned int i = 0; i < mSlicers.size(); i++) { mSlicers[i]->SetFusion(mFusionReader->GetOutput()); @@ -351,7 +349,7 @@ bool vvSlicerManager::SetFusionSequence(std::vector filenames, int } //adjust the time slider in the overlay panel - mFusionSequenceNbFrames = mFusionSequenceReader->GetOutput()->GetTransform().size()-1; //actually, this is the maximum index... + mFusionSequenceNbFrames = mFusionSequenceReader->GetOutput()->GetTransform().size(); mFusionSequenceFrameIndex = std::max( 0, std::min(mFusionSequenceFrameIndex, mFusionSequenceNbFrames)); return true; @@ -965,6 +963,10 @@ void vvSlicerManager::ReloadFusion() //the secondary sequence is being reloaded. void vvSlicerManager::ReloadFusionSequence() { + // this is to keep the slice thickness, which needs to be artificially increased for visualization + double sp_x, sp_y, sp_z; + this->GetImage()->GetVTKImages()[0]->GetSpacing(sp_x, sp_y, sp_z); + mFusionSequenceReader->Update(mImage->GetNumberOfDimensions(),mFusionComponent.c_str(),vvImageReader::MERGEDWITHTIME); for ( unsigned int i = 0; i < mSlicers.size(); i++) { @@ -984,6 +986,13 @@ void vvSlicerManager::ReloadFusionSequence() this->AddFusionSequenceInitialTransformMatrices( mFusionSequenceReader->GetOutput()->GetTransform()[i]->GetMatrix() ); } + // also update the slice thickness + for (unsigned i=0 ; iGetImage()->GetTransform().size() ; i++) { + sp_x = this->GetImage()->GetVTKImages()[i]->GetSpacing()[0]; + sp_y = this->GetImage()->GetVTKImages()[i]->GetSpacing()[1]; + this->GetImage()->GetVTKImages()[i]->SetSpacing( sp_x, sp_y, sp_z); + } + } //----------------------------------------------------------------------------