X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvSlicerManager.cxx;h=89fd42b49fae4177e89ec0c2ee4590e38c9a6f54;hb=857c9e74552dccd4c71364c15cca4ade140511fc;hp=94a834f2f5277d2e50d952bc2dff5f154228a0da;hpb=407e3715e0917fcbb1556342f6ac9ac2ead0e476;p=clitk.git diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 94a834f..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; @@ -785,7 +783,6 @@ void vvSlicerManager::UpdateLinked(int slicer) for (std::list::const_iterator i = mLinkedId.begin(); i != mLinkedId.end(); i++) { if (this->IsInvolvedInFusionSequence()) { //this SlicerManager is involved in fusionSequence => do not synchronize the times - //TODO: check is something more specific should be done ... emit UpdateLinkManager(*i, slicer, p[0], p[1], p[2], -1); } else { @@ -966,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++) { @@ -985,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); + } + } //---------------------------------------------------------------------------- @@ -1245,41 +1253,46 @@ void vvSlicerManager::SetSlicingPreset(SlicingPresetType preset) //---------------------------------------------------------------------------- void vvSlicerManager::SetPreset(int preset) { + //vtkLookupTable* LUT = static_cast(mSlicers[0]->GetWindowLevel()->GetLookupTable()); double window = mSlicers[0]->GetColorWindow(); double level = mSlicers[0]->GetColorLevel(); std::string component_type=mImage->GetScalarTypeAsITKString(); switch (preset) { - case 0: + case WL_AUTO: double range[2]; mImage->GetScalarRange(range); window = range[1] - range[0]; level = (range[1] + range[0])* 0.5; break; - case 1: + case WL_HOUNSFIELD: window = 2000; level = 0; break; - case 2: + case WL_SOFTTISSUE: window = 400; level = 20; break; - case 3: // lungs (same as FOCAL) + case WL_LUNGS: // lungs (same as FOCAL) window = 1700; level = -300; break; - case 4: + case WL_BONES: window = 1000; level = 500; break; - case 5: + case WL_HEAD: + window = 200; + level = 70; + break; + case WL_BINARY: window = 1; level = 0.5; break; - case 6: + case WL_USER: break; - case 7: + case WL_VENTILATION: window=1.; level=0.; break; @@ -1329,7 +1342,7 @@ void vvSlicerManager::SetLocalColorWindowing(const int slicer, const bool bCtrlK this->mSlicers[slicer]->GetConcatenatedTransform()); this->SetColorWindow(max-min); this->SetColorLevel(0.5*(min+max)); - this->SetPreset(6); + this->SetPreset(WL_USER); } this->Render(); this->UpdateWindowLevel();