+
+
+ if (!mFusionReslice) {
+ mFusionReslice = vtkSmartPointer<vtkImageReslice>::New();
+ mFusionReslice->SetInterpolationModeToLinear();
+ mFusionReslice->AutoCropOutputOn();
+ mFusionReslice->SetBackgroundColor(-1000,-1000,-1000,1);
+ }
+
+ mConcatenatedFusionTransform = vtkSmartPointer<vtkTransform>::New();
+ mConcatenatedFusionTransform->Identity();
+ if (!mImage->GetTransform().empty()){
+ mConcatenatedFusionTransform->Concatenate(mImage->GetTransform()[0]);
+ }
+ mConcatenatedFusionTransform->Concatenate(mSlicer->GetSlicingTransform());
+ mFusionReslice->SetResliceAxes(mConcatenatedFusionTransform->GetMatrix());
+ if (mImage->IsTimeSequence()) {
+#if VTK_MAJOR_VERSION <= 5
+ mFusionReslice->SetInput(0, mImage->GetVTKImages()[numImage]);
+ mFusionReslice->UpdateInformation();
+#else
+ mFusionReslice->SetInputData(0, mImage->GetVTKImages()[numImage]);
+#endif
+ } else {
+#if VTK_MAJOR_VERSION <= 5
+ mFusionReslice->SetInput(0, mImage->GetVTKImages()[0]);
+ mFusionReslice->UpdateInformation();
+#else
+ mFusionReslice->SetInputData(0, mImage->GetVTKImages()[0]);
+#endif
+ }
+ mFusionReslice->Update();
+
+
+
+ vtkSmartPointer<vtkImageMapToRGBA> mOverlayMapper = vtkSmartPointer<vtkImageMapToRGBA>::New();
+#if VTK_MAJOR_VERSION <= 5
+ mOverlayMapper->SetInput(mFusionReslice->GetOutput());
+#else
+ mOverlayMapper->SetInputConnection(mFusionReslice->GetOutputPort(0));
+#endif
+
+ double range[2];
+ if (mImage->IsTimeSequence())
+ {
+ mImage->GetVTKImages()[numImage]->GetScalarRange(range);
+ }
+ else {
+ mImage->GetVTKImages()[0]->GetScalarRange(range);
+ }
+ int n = range[1]-range[0]+1;
+ mColorLUT->SetRange(range[0],range[1]);
+ mColorLUT->SetNumberOfTableValues(n);
+
+ // Mode BG -> all is color except BG
+ if (m_modeBG) {
+ for(int i=0; i<n; i++) {
+ mColorLUT->SetTableValue(i, mColor[0], mColor[1], mColor[2], mAlpha);
+ }
+ mColorLUT->SetTableValue(mBackgroundValue, 0, 0, 0, 0.0);
+ }
+ else {
+ // Mode FG -> all is BG, except FG which is color
+ for(int i=0; i<n; i++) {
+ mColorLUT->SetTableValue(i, 0, 0, 0, 0.0);
+ }
+ mColorLUT->SetTableValue(mForegroundValue, mColor[0], mColor[1], mColor[2], mAlpha);
+ }
+
+ mOverlayMapper->SetLookupTable(mColorLUT);
+
+ vtkSmartPointer<vtkImageActor> mOverlayActor = vtkSmartPointer<vtkImageActor>::New();
+#if VTK_MAJOR_VERSION <= 5