1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
21 #include "vvSlicerManagerCommand.h"
22 #include "vvGlyphSource.h"
23 #include "vvGlyph2D.h"
24 #include "vvImageMapToWLColors.h"
26 #include <vtkTextProperty.h>
27 #include <vtkTextActor.h>
28 #include <vtkTextSource.h>
29 #include <vtkActor2D.h>
30 #include <vtkCursor2D.h>
31 #include <vtkPolyDataMapper2D.h>
32 #include <vtkProperty2D.h>
33 #include <vtkCornerAnnotation.h>
34 #include <vtkImageMapToWindowLevelColors.h>
35 #include <vtkImageData.h>
36 #include <vtkImageActor.h>
37 #include <vvBlendImageActor.h>
38 #include <vtkToolkits.h>
39 #include <vtkObjectFactory.h>
40 #include <vtkPointData.h>
41 #include <vtkDataArray.h>
42 #include <vtkFloatArray.h>
43 #include <vtkClipPolyData.h>
44 #include <vtkGlyph3D.h>
46 #include <vtkCursor3D.h>
47 #include <vtkProperty.h>
49 #include <vtkLightCollection.h>
50 #include <vtkScalarBarActor.h>
51 #include <vtkLookupTable.h>
53 #include <vtkRenderer.h>
54 #include <vtkRendererCollection.h>
55 #include <vtkRenderWindow.h>
56 #include <vtkRenderWindowInteractor.h>
57 #include <vtkCamera.h>
58 #include <vtkCallbackCommand.h>
59 #include <vtkCommand.h>
60 #include <vtkPolyDataMapper.h>
63 #include <vtkExtractVOI.h>
64 #include <vtkSphereSource.h>
65 #include <vtkCutter.h>
66 #include <vtkAssignAttribute.h>
67 #include <vtkImageAccumulate.h>
68 #include <vtkImageReslice.h>
70 vtkCxxRevisionMacro(vvSlicer, "DummyRevision");
71 vtkStandardNewMacro(vvSlicer);
72 static void copyExtent(int* in, int* to){
73 for(int i=0; i<6; ++i) to[i]=in[i];
75 //------------------------------------------------------------------------------
78 this->UnInstallPipeline();
80 mReducedExtent = new int[6];
82 mUseReducedExtent = false;
84 mCurrent[0] = -VTK_DOUBLE_MAX;
85 mCurrent[1] = -VTK_DOUBLE_MAX;
86 mCurrent[2] = -VTK_DOUBLE_MAX;
88 mCursor[0] = -VTK_DOUBLE_MAX;
89 mCursor[1] = -VTK_DOUBLE_MAX;
90 mCursor[2] = -VTK_DOUBLE_MAX;
91 mCursor[3] = -VTK_DOUBLE_MAX;
101 crossCursor = vtkSmartPointer<vtkCursor2D>::New();
102 crossCursor->AllOff();
103 crossCursor->AxesOn();
104 crossCursor->SetTranslationMode(1);
105 crossCursor->SetRadius(2);
107 pdm = vtkSmartPointer<vtkPolyDataMapper2D>::New();
108 pdm->SetInput(crossCursor->GetOutput());
110 pdmA = vtkSmartPointer<vtkActor2D>::New();
111 pdmA->SetMapper(pdm);
112 pdmA->GetProperty()->SetColor(255,10,212);
113 pdmA->SetVisibility(0);
114 pdmA->SetPickable(0);
116 ca = vtkSmartPointer<vtkCornerAnnotation>::New();
117 ca->GetTextProperty()->SetColor(255,10,212);
118 ca->SetVisibility(1);
126 legend = vtkSmartPointer<vtkScalarBarActor>::New();
127 //legend->SetTitle("test!");
128 legend->SetPosition(0.82,0.18);
129 legend->SetWidth(0.1);
130 legend->SetVisibility(0);
131 legend->SetLabelFormat("%.1f");
132 this->GetRenderer()->AddActor(legend);
133 showFusionLegend = true;
135 this->WindowLevel->Delete();
136 this->WindowLevel = vvImageMapToWLColors::New();
138 this->InstallPipeline();
140 mLinkOverlayWindowLevel = true;
142 //------------------------------------------------------------------------------
145 //------------------------------------------------------------------------------
146 vtkImageMapToWindowLevelColors* vvSlicer::GetOverlayMapper()
148 return mOverlayMapper.GetPointer();
150 //------------------------------------------------------------------------------
153 //------------------------------------------------------------------------------
154 vvBlendImageActor* vvSlicer::GetOverlayActor()
156 return mOverlayActor.GetPointer();
158 //------------------------------------------------------------------------------
161 //------------------------------------------------------------------------------
162 vtkImageMapToColors* vvSlicer::GetFusionMapper()
164 return mFusionMapper.GetPointer();
166 //------------------------------------------------------------------------------
169 //------------------------------------------------------------------------------
170 vtkImageActor* vvSlicer::GetFusionActor()
172 return mFusionActor.GetPointer();
174 //------------------------------------------------------------------------------
177 //------------------------------------------------------------------------------
178 vtkActor* vvSlicer::GetVFActor()
180 return mVFActor.GetPointer();
182 //------------------------------------------------------------------------------
185 //------------------------------------------------------------------------------
186 vtkCornerAnnotation* vvSlicer::GetAnnotation()
188 return ca.GetPointer();
190 //------------------------------------------------------------------------------
193 //------------------------------------------------------------------------------
194 void vvSlicer::EnableReducedExtent(bool b)
196 mUseReducedExtent = b;
198 //------------------------------------------------------------------------------
201 //------------------------------------------------------------------------------
202 void vvSlicer::SetReducedExtent(int * ext)
204 copyExtent(ext, mReducedExtent);
206 //------------------------------------------------------------------------------
209 //------------------------------------------------------------------------------
210 void vvSlicer::AddContour(vvMesh::Pointer contour,bool propagate)
213 mSurfaceCutActors.push_back(new vvMeshActor());
215 mSurfaceCutActors.back()->Init(contour,mCurrentTSlice,mVF);
217 mSurfaceCutActors.back()->Init(contour,mCurrentTSlice);
218 mSurfaceCutActors.back()->SetSlicingOrientation(SliceOrientation);
219 this->GetRenderer()->AddActor(mSurfaceCutActors.back()->GetActor());
223 //------------------------------------------------------------------------------
226 //------------------------------------------------------------------------------
227 void vvSlicer::ToggleContourSuperposition()
229 for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
230 i!=mSurfaceCutActors.end(); i++)
231 (*i)->ToggleSuperposition();
233 //------------------------------------------------------------------------------
236 //------------------------------------------------------------------------------
237 void vvSlicer::SetCursorColor(int r,int g, int b)
239 pdmA->GetProperty()->SetColor(r,g,b);
241 //------------------------------------------------------------------------------
244 //------------------------------------------------------------------------------
245 void vvSlicer::SetCursorVisibility(bool s)
247 pdmA->SetVisibility(s);
249 //------------------------------------------------------------------------------
252 //------------------------------------------------------------------------------
253 bool vvSlicer::GetCursorVisibility()
255 return pdmA->GetVisibility();
257 //------------------------------------------------------------------------------
260 //------------------------------------------------------------------------------
261 void vvSlicer::SetCornerAnnotationVisibility(bool s)
263 ca->SetVisibility(s);
265 //------------------------------------------------------------------------------
268 //------------------------------------------------------------------------------
269 bool vvSlicer::GetCornerAnnotationVisibility()
271 return ca->GetVisibility();
273 //------------------------------------------------------------------------------
276 //------------------------------------------------------------------------------
277 vvSlicer::~vvSlicer()
279 for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
280 i!=mSurfaceCutActors.end(); i++)
282 delete [] mReducedExtent;
284 //------------------------------------------------------------------------------
287 //------------------------------------------------------------------------------
288 void vvSlicer::SetCurrentPosition(double x, double y, double z, int t)
295 //------------------------------------------------------------------------------
298 //------------------------------------------------------------------------------
299 void vvSlicer::SetImage(vvImage::Pointer image)
301 if (image->GetVTKImages().size()) {
304 if (!mImageReslice) {
305 mImageReslice = vtkSmartPointer<vtkImageReslice>::New();
306 mImageReslice->SetInterpolationModeToLinear();
307 mImageReslice->AutoCropOutputOn();
308 mImageReslice->SetBackgroundColor(-1000,-1000,-1000,1);
310 mImageReslice->SetResliceTransform(mImage->GetTransform());
311 mImageReslice->SetInput(0, mImage->GetFirstVTKImageData());
312 mImageReslice->UpdateInformation();
314 this->Superclass::SetInput(mImageReslice->GetOutput());
317 this->GetInput()->GetWholeExtent(extent);
319 // Prevent crash when reload -> change slice if outside extent
320 if (Slice < extent[SliceOrientation*2] || Slice>=extent[SliceOrientation*2+1]) {
321 Slice = (extent[SliceOrientation*2+1]+extent[SliceOrientation*2])/2.0;
324 // Make sure that the required part image has been computed
325 extent[SliceOrientation*2] = Slice;
326 extent[SliceOrientation*2+1] = Slice;
327 mImageReslice->GetOutput()->SetUpdateExtent(extent);
328 mImageReslice->GetOutput()->Update();
330 this->UpdateDisplayExtent();
333 ca->SetText(0,mFileName.c_str());
336 //------------------------------------------------------------------------------
339 //------------------------------------------------------------------------------
340 void vvSlicer::SetOverlay(vvImage::Pointer overlay)
342 if (overlay->GetVTKImages().size()) {
345 if (!mOverlayReslice) {
346 mOverlayReslice = vtkSmartPointer<vtkImageReslice>::New();
347 mOverlayReslice->SetInterpolationModeToLinear();
348 mOverlayReslice->AutoCropOutputOn();
349 mOverlayReslice->SetBackgroundColor(-1000,-1000,-1000,1);
351 mOverlayReslice->SetResliceTransform(mOverlay->GetTransform());
352 mOverlayReslice->SetInput(0, mOverlay->GetFirstVTKImageData());
355 mOverlayMapper = vtkSmartPointer<vtkImageMapToWindowLevelColors>::New();
356 mOverlayMapper->SetInput(mOverlayReslice->GetOutput());
358 if (!mOverlayActor) {
359 mOverlayActor = vtkSmartPointer<vvBlendImageActor>::New();
360 mOverlayActor->SetInput(mOverlayMapper->GetOutput());
361 mOverlayActor->SetPickable(0);
362 mOverlayActor->SetVisibility(true);
363 mOverlayActor->SetOpacity(0.5);
366 //stupid but necessary : the Overlay need to be rendered before fusion
368 this->GetRenderer()->RemoveActor(mFusionActor);
369 this->GetRenderer()->AddActor(mOverlayActor);
370 this->GetRenderer()->AddActor(mFusionActor);
372 this->GetRenderer()->AddActor(mOverlayActor);
374 //Synchronize orientation and slice
375 AdjustResliceToSliceOrientation(mOverlayReslice);
376 this->UpdateDisplayExtent();
377 this->SetTSlice(mCurrentTSlice);
380 //------------------------------------------------------------------------------
383 //------------------------------------------------------------------------------
384 void vvSlicer::SetFusion(vvImage::Pointer fusion)
386 if (fusion->GetVTKImages().size()) {
389 if (!mFusionReslice) {
390 mFusionReslice = vtkSmartPointer<vtkImageReslice>::New();
391 mFusionReslice->SetInterpolationModeToLinear();
392 mFusionReslice->AutoCropOutputOn();
393 mFusionReslice->SetBackgroundColor(-1000,-1000,-1000,1);
395 mFusionReslice->SetResliceTransform(mFusion->GetTransform());
396 mFusionReslice->SetInput(0, mFusion->GetFirstVTKImageData());
399 mFusionMapper = vtkSmartPointer<vtkImageMapToColors>::New();
401 vtkSmartPointer<vtkLookupTable> lut = vtkLookupTable::New();
403 lut->SetValueRange(0, 1);
404 lut->SetSaturationRange(0, 0);
406 mFusionMapper->SetLookupTable(lut);
407 mFusionMapper->SetInput(mFusionReslice->GetOutput());
410 mFusionActor = vtkSmartPointer<vtkImageActor>::New();
411 mFusionActor->SetInput(mFusionMapper->GetOutput());
412 mFusionActor->SetPickable(0);
413 mFusionActor->SetVisibility(true);
414 mFusionActor->SetOpacity(0.7);
415 this->GetRenderer()->AddActor(mFusionActor);
418 //Synchronize orientation and slice
419 AdjustResliceToSliceOrientation(mFusionReslice);
420 this->UpdateDisplayExtent();
421 this->SetTSlice(mCurrentTSlice);
424 //------------------------------------------------------------------------------
427 //------------------------------------------------------------------------------
428 bool vvSlicer::GetActorVisibility(const std::string& actor_type, int overlay_index)
431 if (actor_type == "image") {
432 vis = this->ImageActor->GetVisibility();
434 else if (actor_type == "vector") {
435 vis = this->mVFActor->GetVisibility();
437 else if (actor_type == "overlay") {
438 vis = this->mOverlayActor->GetVisibility();
440 else if (actor_type == "fusion") {
441 vis = this->mFusionActor->GetVisibility();
443 else if (actor_type == "contour")
444 vis = this->mSurfaceCutActors[overlay_index]->GetActor()->GetVisibility();
448 //------------------------------------------------------------------------------
450 //------------------------------------------------------------------------------
451 void vvSlicer::SetActorVisibility(const std::string& actor_type, int overlay_index ,bool vis)
453 if (actor_type == "image") {
454 this->ImageActor->SetVisibility(vis);
456 else if (actor_type == "vector") {
457 this->mVFActor->SetVisibility(vis);
459 else if (actor_type == "overlay") {
460 this->mOverlayActor->SetVisibility(vis);
462 else if (actor_type == "fusion") {
463 this->mFusionActor->SetVisibility(vis);
465 else if (actor_type == "contour")
466 this->mSurfaceCutActors[overlay_index]->GetActor()->SetVisibility(vis);
467 UpdateDisplayExtent();
469 //------------------------------------------------------------------------------
471 //------------------------------------------------------------------------------
472 void vvSlicer::SetVF(vvImage::Pointer vf)
474 if (vf->GetVTKImages().size()) {
478 mAAFilter= vtkSmartPointer<vtkAssignAttribute>::New();
479 mVOIFilter = vtkSmartPointer<vtkExtractVOI>::New();
480 mVOIFilter->SetSampleRate(mSubSampling,mSubSampling,mSubSampling);
482 mVOIFilter->SetInput(vf->GetFirstVTKImageData());
483 mAAFilter->SetInput(mVOIFilter->GetOutput());
484 ///This tells VTK to use the scalar (pixel) data of the image to draw the little arrows
485 mAAFilter->Assign(vtkDataSetAttributes::SCALARS, vtkDataSetAttributes::VECTORS, vtkAssignAttribute::POINT_DATA);
488 mArrow = vtkSmartPointer<vvGlyphSource>::New();
489 mArrow->SetGlyphTypeToSpecificArrow();
490 mArrow->SetScale(mScale);
493 // Glyph the gradient vector (with arrows)
495 mGlyphFilter = vtkSmartPointer<vvGlyph2D>::New();
496 mGlyphFilter->SetInput(mAAFilter->GetOutput());
497 mGlyphFilter->SetSource(mArrow->GetOutput());
498 mGlyphFilter->ScalingOn();
499 mGlyphFilter->SetScaleModeToScaleByVector();
500 mGlyphFilter->OrientOn();
501 mGlyphFilter->SetVectorModeToUseVector();
502 mGlyphFilter->SetColorModeToColorByVector();
505 mVFColorLUT = vtkSmartPointer<vtkLookupTable>::New();
507 double mVFColorHSV[3];
508 vtkMath::RGBToHSV(mVFColor, mVFColorHSV);
509 mVFColorLUT->SetHueRange(mVFColorHSV[0], mVFColorHSV[0]);
510 mVFColorLUT->SetSaturationRange(mVFColorHSV[1],mVFColorHSV[1]);
511 mVFColorLUT->SetValueRange(mVFColorHSV[2], mVFColorHSV[2]);
514 mVFMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
515 mVFMapper->SetInput(mGlyphFilter->GetOutput());
516 mVFMapper->ImmediateModeRenderingOn();
517 mVFMapper->SetLookupTable(mVFColorLUT);
520 mVFActor = vtkSmartPointer<vtkActor>::New();
521 mVFActor->SetMapper(mVFMapper);
522 mVFActor->SetPickable(0);
523 mVFActor->GetProperty()->SetLineWidth(mVFWidth);
524 this->UpdateDisplayExtent();
525 this->GetRenderer()->AddActor(mVFActor);
528 SetTSlice(mCurrentTSlice);
531 //------------------------------------------------------------------------------
534 //------------------------------------------------------------------------------
535 void vvSlicer::SetLandmarks(vvLandmarks* landmarks)
537 mLandmarks = landmarks;
541 mCross = vtkSmartPointer<vtkCursor3D>::New();
542 mCross->SetFocalPoint(0.0,0.0,0.0);
543 mCross->SetModelBounds(-10,10,-10,10,-10,10);
548 mLandGlyph = vtkSmartPointer<vtkGlyph3D>::New();
549 mLandGlyph->SetSource(mCross->GetOutput());
550 mLandGlyph->SetInput(landmarks->GetOutput());
551 //mLandGlyph->SetIndexModeToScalar();
552 mLandGlyph->SetRange(0,1);
553 mLandGlyph->ScalingOff();
555 mLandGlyph->SetColorModeToColorByScalar();
558 mClipBox = vtkSmartPointer<vtkBox>::New();
560 mLandClipper = vtkSmartPointer<vtkClipPolyData>::New();
561 mLandClipper->InsideOutOn();
562 mLandClipper->SetInput(mLandGlyph->GetOutput());
563 mLandClipper->SetClipFunction(mClipBox);
566 mLandMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
567 mLandMapper->SetInputConnection(mLandClipper->GetOutputPort());
568 //mLandMapper->ScalarVisibilityOff();
571 mLandActor = vtkSmartPointer<vtkActor>::New();
572 mLandActor->SetMapper(mLandMapper);
573 mLandActor->GetProperty()->SetColor(255,10,212);
574 mLandActor->SetPickable(0);
575 mLandActor->SetVisibility(true);
576 this->UpdateDisplayExtent();
577 this->GetRenderer()->AddActor(mLandActor);
580 //------------------------------------------------------------------------------
582 //------------------------------------------------------------------------------
583 //FIXME: this function leaks memory, we should fix it someday :)
584 void vvSlicer::RemoveActor(const std::string& actor_type, int overlay_index)
586 if (actor_type == "vector") {
587 Renderer->RemoveActor(mVFActor);
596 if (actor_type == "overlay") {
597 Renderer->RemoveActor(mOverlayActor);
599 mOverlayActor = NULL;
600 mOverlayMapper = NULL;
602 if (actor_type == "fusion") {
603 Renderer->RemoveActor(mFusionActor);
606 mFusionMapper = NULL;
608 if (actor_type == "contour") {
609 Renderer->RemoveActor(this->mSurfaceCutActors[overlay_index]->GetActor());
610 mSurfaceCutActors.erase(mSurfaceCutActors.begin()+overlay_index);
613 //------------------------------------------------------------------------------
616 //------------------------------------------------------------------------------
617 void vvSlicer::SetVFSubSampling(int sub)
620 mVOIFilter->SetSampleRate(mSubSampling,mSubSampling,mSubSampling);
623 UpdateDisplayExtent();
626 //------------------------------------------------------------------------------
629 //------------------------------------------------------------------------------
630 void vvSlicer::SetVFScale(int scale)
634 mArrow->SetScale(mScale);
635 UpdateDisplayExtent();
638 //------------------------------------------------------------------------------
640 //------------------------------------------------------------------------------
641 void vvSlicer::SetVFWidth(int width)
645 mVFActor->GetProperty()->SetLineWidth(mVFWidth);
646 UpdateDisplayExtent();
649 //------------------------------------------------------------------------------
652 //------------------------------------------------------------------------------
653 void vvSlicer::SetVFLog(int log)
657 mGlyphFilter->SetUseLog(mVFLog);
658 mGlyphFilter->Modified();
660 UpdateDisplayExtent();
663 //------------------------------------------------------------------------------
666 //------------------------------------------------------------------------------
667 void vvSlicer::SetTSlice(int t)
671 else if ((unsigned int)t >= mImage->GetVTKImages().size())
672 t = mImage->GetVTKImages().size() -1;
674 if (mCurrentTSlice == t) return;
677 mImageReslice->SetInput( mImage->GetVTKImages()[mCurrentTSlice] );
678 if (mVF && mVFActor->GetVisibility()) {
679 if (mVF->GetVTKImages().size() > (unsigned int)mCurrentTSlice)
680 mVOIFilter->SetInput(mVF->GetVTKImages()[mCurrentTSlice]);
682 if (mOverlay && mOverlayActor->GetVisibility()) {
683 if (mOverlay->GetVTKImages().size() > (unsigned int)mCurrentTSlice)
684 mOverlayReslice->SetInput( mOverlay->GetVTKImages()[mCurrentTSlice] );
686 if (mFusion && mFusionActor->GetVisibility()) {
687 if (mFusion->GetVTKImages().size() > (unsigned int)mCurrentTSlice)
688 mFusionReslice->SetInput( mFusion->GetVTKImages()[mCurrentTSlice]);
690 if (mSurfaceCutActors.size() > 0)
691 for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
692 i!=mSurfaceCutActors.end(); i++)
693 (*i)->SetTimeSlice(mCurrentTSlice);
694 UpdateDisplayExtent();
696 //------------------------------------------------------------------------------
699 //------------------------------------------------------------------------------
700 int vvSlicer::GetTSlice()
702 return mCurrentTSlice;
704 //------------------------------------------------------------------------------
706 //------------------------------------------------------------------------------
707 void vvSlicer::SetSliceOrientation(int orientation)
709 //if 2D image, force to watch in Axial View
711 this->GetInput()->GetWholeExtent(extent);
712 if (extent[5]-extent[4] <= 2)
713 orientation = vtkImageViewer2::SLICE_ORIENTATION_XY;
715 if (orientation < vtkImageViewer2::SLICE_ORIENTATION_YZ ||
716 orientation > vtkImageViewer2::SLICE_ORIENTATION_XY) {
717 vtkErrorMacro("Error - invalid slice orientation " << orientation);
721 this->SliceOrientation = orientation;
724 AdjustResliceToSliceOrientation(mFusionReslice);
727 AdjustResliceToSliceOrientation(mOverlayReslice);
730 int *range = this->GetSliceRange();
732 this->Slice = static_cast<int>((range[0] + range[1]) * 0.5);
734 // Go to current cursor position
735 // double* cursorPos = GetCursorPosition();
736 // DDV(cursorPos, 3);
737 // SetCurrentPosition(cursorPos[0],cursorPos[1],cursorPos[2],cursorPos[3]);
739 this->UpdateOrientation();
740 this->UpdateDisplayExtent();
742 if (this->Renderer && this->GetInput()) {
743 double scale = this->Renderer->GetActiveCamera()->GetParallelScale();
744 this->Renderer->ResetCamera();
745 this->Renderer->GetActiveCamera()->SetParallelScale(scale);
750 //----------------------------------------------------------------------------
752 //------------------------------------------------------------------------------
753 // This function ensures that we sample the slices of a vtkImageReslice filter
754 // in the direction of the slicer (SliceOrientation) similarly as mImageReslice.
755 // In other words, we change the grid of the reslice in the same way as the grid
756 // of the displayed image in the slicing direction.
757 void vvSlicer::AdjustResliceToSliceOrientation(vtkImageReslice *reslice)
759 // Reset autocrop and update output information
760 reslice->SetOutputOriginToDefault();
761 reslice->SetOutputSpacingToDefault();
762 reslice->GetOutput()->UpdateInformation();
764 // Ge new origin / spacing
767 reslice->GetOutput()->GetOrigin(origin);
768 reslice->GetOutput()->GetSpacing(spacing);
770 // Use similar spacing as the image in the direction SliceOrientation
771 spacing[this->SliceOrientation] = mImageReslice->GetOutput()->GetSpacing()[this->SliceOrientation];
773 // Modify origin to be on the image grid in the direction SliceOrientation in 3 steps
774 // Step 1: from world coordinates to image coordinates
775 origin[this->SliceOrientation] -= mImageReslice->GetOutput()->GetOrigin()[this->SliceOrientation];
776 origin[this->SliceOrientation] /= mImageReslice->GetOutput()->GetSpacing()[this->SliceOrientation];
777 // Step 2: round to superior grid positionInc
778 origin[this->SliceOrientation] = itk::Math::Ceil<double>(origin[this->SliceOrientation]);
779 // Step 3: back to world coordinates
780 origin[this->SliceOrientation] *= mImageReslice->GetOutput()->GetSpacing()[this->SliceOrientation];
781 origin[this->SliceOrientation] += mImageReslice->GetOutput()->GetOrigin()[this->SliceOrientation];
783 // Set new spacing and origin
784 reslice->SetOutputOrigin(origin);
785 reslice->SetOutputSpacing(spacing);
786 reslice->UpdateInformation();
787 reslice->GetOutput()->UpdateInformation();
789 //------------------------------------------------------------------------------
791 //----------------------------------------------------------------------------
792 int * vvSlicer::GetExtent(){
794 if (mUseReducedExtent) {
795 w_ext = mReducedExtent;
796 } else w_ext = GetInput()->GetWholeExtent();
799 //----------------------------------------------------------------------------
802 //----------------------------------------------------------------------------
803 int vvSlicer::GetOrientation()
805 return this->SliceOrientation;
807 //----------------------------------------------------------------------------
810 //----------------------------------------------------------------------------
811 void vvSlicer::UpdateDisplayExtent()
813 vtkImageData *input = this->GetInput();
814 if (!input || !this->ImageActor) {
817 input->UpdateInformation();
819 // Local copy of extent
821 int* ext = GetExtent();
822 copyExtent(ext, w_ext);
824 int s = this->Slice > ext[this->SliceOrientation*2+1] ? ext[this->SliceOrientation*2 + 1] : this->Slice;
825 w_ext[ this->SliceOrientation*2 ] = s;
826 w_ext[ this->SliceOrientation*2+1 ] = s;
829 this->ImageActor->SetDisplayExtent(w_ext);
831 // Overlay image actor
832 if (mOverlay && mOverlayActor->GetVisibility()) {
833 AdjustResliceToSliceOrientation(mOverlayReslice);
835 this->ConvertImageToImageDisplayExtent(input, w_ext, mOverlayReslice->GetOutput(), overExtent);
836 ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetWholeExtent());
837 mOverlayActor->SetDisplayExtent( overExtent );
840 // Fusion image actor
841 if (mFusion && mFusionActor->GetVisibility()) {
842 AdjustResliceToSliceOrientation(mFusionReslice);
844 this->ConvertImageToImageDisplayExtent(input, w_ext, mFusionReslice->GetOutput(), fusExtent);
845 ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetWholeExtent());
846 mFusionActor->SetDisplayExtent(fusExtent);
849 // Vector field actor
850 double* camera = Renderer->GetActiveCamera()->GetPosition();
851 double* image_bounds = ImageActor->GetBounds();
852 double position[3] = {0, 0, 0};
853 position[this->SliceOrientation] = image_bounds[this->SliceOrientation*2];
855 //print_vector<double, 6>("camera", camera);
856 //print_vector<double, 6>("image_bounds", image_bounds);
857 //print_vector<double, 3>("position", position);
859 // find where to place the VF actor. to deal with
860 // z-buffer issues, the VF is placed right in front of the image,
861 // subject to a small offset. the position actually depends on the
862 // the location of the camera relative to the image.
864 if (camera[this->SliceOrientation] < image_bounds[this->SliceOrientation*2])
867 if (mVF && mVFActor->GetVisibility()) {
869 mVF->GetVTKImages()[0]->UpdateInformation();
870 this->ConvertImageToImageDisplayExtent(input, w_ext, mVF->GetVTKImages()[0], vfExtent);
871 ClipDisplayedExtent(vfExtent, mVOIFilter->GetInput()->GetWholeExtent());
872 mVOIFilter->SetVOI(vfExtent);
873 int orientation[3] = {1,1,1};
874 orientation[this->SliceOrientation] = 0;
875 mGlyphFilter->SetOrientation(orientation[0], orientation[1], orientation[2]);
878 position[this->SliceOrientation] += offset;
879 mVFActor->SetPosition(position);
886 for(unsigned int i=0; i<6; i++)
887 bounds[i] = ImageActor->GetBounds()[i];
888 bounds[ this->SliceOrientation*2 ] = ImageActor->GetBounds()[ this->SliceOrientation*2 ]-fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
889 bounds[ this->SliceOrientation*2+1 ] = ImageActor->GetBounds()[ this->SliceOrientation*2+1 ]+fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
890 mClipBox->SetBounds(bounds);
894 position[this->SliceOrientation] = offset;
895 mLandActor->SetPosition(position);
898 // Figure out the correct clipping range
899 if (this->Renderer) {
900 if (this->InteractorStyle &&
901 this->InteractorStyle->GetAutoAdjustCameraClippingRange()) {
902 this->Renderer->ResetCameraClippingRange();
904 vtkCamera *cam = this->Renderer->GetActiveCamera();
907 this->ImageActor->GetBounds(bounds);
908 double spos = (double)bounds[this->SliceOrientation * 2];
909 double cpos = (double)cam->GetPosition()[this->SliceOrientation];
910 double range = fabs(spos - cpos);
911 double *spacing = input->GetSpacing();
913 ((double)spacing[0] + (double)spacing[1] + (double)spacing[2]) / 3.0;
914 cam->SetClippingRange(range - avg_spacing * 3.0, range + avg_spacing * 3.0);
920 //----------------------------------------------------------------------------
922 //----------------------------------------------------------------------------
923 void vvSlicer::ConvertImageToImageDisplayExtent(vtkImageData *sourceImage, const int sourceExtent[6],
924 vtkImageData *targetImage, int targetExtent[6])
927 for(unsigned int i=0; i<6; i++) {
928 // From source voxel coordinates to world coordinates
929 dExtents[i] = sourceImage->GetOrigin()[i/2] + sourceImage->GetSpacing()[i/2] * sourceExtent[i];
931 // From world coordinates to floating point target voxel coordinates
932 dExtents[i] = (dExtents[i]- targetImage->GetOrigin()[i/2]) / targetImage->GetSpacing()[i/2];
935 //targetExtent[i] = itk::Math::Round<double>(dExtents[i]);
936 targetExtent[i] = itk::Math::Floor<double>(dExtents[i]);
939 //----------------------------------------------------------------------------
941 //----------------------------------------------------------------------------
942 void vvSlicer::ClipDisplayedExtent(int extent[6], int refExtent[6])
947 //2D overlay on 3D image specific case
948 if (refExtent[4] == refExtent[5]) {
950 extent[4] = refExtent[4];
951 extent[5] = refExtent[5];
954 for (int i = 0; i < maxBound; i = i+2) {
955 //if we are totally outside the image
956 if ( extent[i] > refExtent[i+1] || extent[i+1] < refExtent[i] ) {
960 //crop to the limit of the image
961 extent[i] = (extent[i] > refExtent[i]) ? extent[i] : refExtent[i];
962 extent[i] = (extent[i] < refExtent[i+1]) ? extent[i] : refExtent[i+1];
963 extent[i+1] = (extent[i+1] > refExtent[i]) ? extent[i+1] : refExtent[i];
964 extent[i+1] = (extent[i+1] < refExtent[i+1]) ? extent[i+1] : refExtent[i+1];
967 for (int i = 0; i < maxBound; i = i+2) {
968 extent[i] = refExtent[i];
969 extent[i+1] = refExtent[i];
972 //----------------------------------------------------------------------------
975 //----------------------------------------------------------------------------
976 void vvSlicer::UpdateOrientation()
978 // Set the camera position
979 vtkCamera *cam = this->Renderer ? this->Renderer->GetActiveCamera() : NULL;
981 switch (this->SliceOrientation) {
982 case vtkImageViewer2::SLICE_ORIENTATION_XY:
983 cam->SetFocalPoint(0,0,0);
984 cam->SetPosition(0,0,-1); // -1 if medical ?
985 cam->SetViewUp(0,-1,0);
988 case vtkImageViewer2::SLICE_ORIENTATION_XZ:
989 cam->SetFocalPoint(0,0,0);
990 cam->SetPosition(0,-1,0); // 1 if medical ?
991 cam->SetViewUp(0,0,1);
994 case vtkImageViewer2::SLICE_ORIENTATION_YZ:
995 cam->SetFocalPoint(0,0,0);
996 cam->SetPosition(-1,0,0); // -1 if medical ?
997 cam->SetViewUp(0,0,1);
1002 //----------------------------------------------------------------------------
1005 //----------------------------------------------------------------------------
1006 void vvSlicer::SetOpacity(double s)
1008 this->GetImageActor()->SetOpacity(s);
1010 //----------------------------------------------------------------------------
1013 //----------------------------------------------------------------------------
1014 void vvSlicer::SetRenderWindow(int orientation, vtkRenderWindow * rw)
1016 this->Superclass::SetRenderWindow(rw);
1017 this->SetupInteractor(rw->GetInteractor());
1018 ca->SetImageActor(this->GetImageActor());
1019 ca->SetWindowLevel(this->GetWindowLevel());
1020 ca->SetText(2, "<slice>");
1021 ca->SetText(3, "<window>\n<level>");
1033 crossCursor->SetModelBounds(bounds);
1034 this->GetRenderer()->AddActor(pdmA);
1035 this->GetRenderer()->AddActor(ca);
1036 this->GetRenderer()->ResetCamera();
1038 //this is just a mapping between the labeling of the orientations presented to the user and
1039 //the one used by vtk
1040 SetSliceOrientation(2-(orientation%3));
1043 //----------------------------------------------------------------------------
1046 //----------------------------------------------------------------------------
1047 void vvSlicer::ResetCamera()
1049 this->GetRenderer()->ResetCamera();
1051 //----------------------------------------------------------------------------
1054 //----------------------------------------------------------------------------
1055 void vvSlicer::SetDisplayMode(bool i)
1057 this->GetRenderer()->SetDraw(i);
1059 UpdateDisplayExtent();
1061 //----------------------------------------------------------------------------
1064 //----------------------------------------------------------------------------
1065 void vvSlicer::FlipHorizontalView()
1067 vtkCamera *cam = this->Renderer ? this->Renderer->GetActiveCamera() : NULL;
1069 double *position = cam->GetPosition();
1070 double factor[3] = {1, 1, 1};
1071 factor[this->SliceOrientation] = -1;
1072 cam->SetPosition(factor[0]*position[0],factor[1]*position[1],factor[2]*position[2]);
1074 /* switch (this->SliceOrientation) {
1075 case vtkImageViewer2::SLICE_ORIENTATION_XY:
1076 cam->SetPosition(position[0],position[1],-position[2]);
1079 case vtkImageViewer2::SLICE_ORIENTATION_XZ:
1080 cam->SetPosition(position[0],-position[1],position[2]);
1083 case vtkImageViewer2::SLICE_ORIENTATION_YZ:
1084 cam->SetPosition(-position[0],position[1],position[2]);
1088 this->Renderer->ResetCameraClippingRange();
1089 this->UpdateDisplayExtent();
1092 //----------------------------------------------------------------------------
1095 //----------------------------------------------------------------------------
1096 void vvSlicer::FlipVerticalView()
1098 vtkCamera *cam = this->Renderer ? this->Renderer->GetActiveCamera() : NULL;
1100 FlipHorizontalView();
1101 double *viewup = cam->GetViewUp();
1102 cam->SetViewUp(-viewup[0],-viewup[1],-viewup[2]);
1103 this->UpdateDisplayExtent();
1106 //----------------------------------------------------------------------------
1109 //----------------------------------------------------------------------------
1110 void vvSlicer::SetColorWindow(double window)
1112 vtkLookupTable* LUT = static_cast<vtkLookupTable*>(this->GetWindowLevel()->GetLookupTable());
1114 double level = this->GetWindowLevel()->GetLevel();
1115 LUT->SetTableRange(level-fabs(window)/2,level+fabs(window)/2);
1118 this->vtkImageViewer2::SetColorWindow(window);
1120 //----------------------------------------------------------------------------
1122 //----------------------------------------------------------------------------
1123 void vvSlicer::SetColorLevel(double level)
1125 vtkLookupTable* LUT = static_cast<vtkLookupTable*>(this->GetWindowLevel()->GetLookupTable());
1127 double window = this->GetWindowLevel()->GetWindow();
1128 LUT->SetTableRange(level-fabs(window)/2,level+fabs(window)/2);
1131 this->vtkImageViewer2::SetColorLevel(level);
1133 //----------------------------------------------------------------------------
1135 //----------------------------------------------------------------------------
1136 double vvSlicer::GetOverlayColorWindow()
1139 return mOverlayMapper->GetWindow();
1143 //----------------------------------------------------------------------------
1145 //----------------------------------------------------------------------------
1146 double vvSlicer::GetOverlayColorLevel()
1149 return mOverlayMapper->GetLevel();
1153 //----------------------------------------------------------------------------
1155 //----------------------------------------------------------------------------
1156 void vvSlicer::SetOverlayColorWindow(double window)
1158 mOverlayMapper->SetWindow(window);
1160 //----------------------------------------------------------------------------
1162 //----------------------------------------------------------------------------
1163 void vvSlicer::SetOverlayColorLevel(double level)
1165 mOverlayMapper->SetLevel(level);
1167 //----------------------------------------------------------------------------
1169 //----------------------------------------------------------------------------
1170 // Returns the min an the max value in a 41x41 region around the mouse pointer
1171 void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max, vtkImageData *image)
1173 //Get mouse pointer position in view coordinates
1174 double fLocalExtents[6];
1175 for(int i=0; i<3; i++) {
1176 fLocalExtents[i*2 ] = mCurrent[i];
1177 fLocalExtents[i*2+1] = mCurrent[i];
1179 this->Renderer->WorldToView(fLocalExtents[0], fLocalExtents[2], fLocalExtents[4]);
1180 this->Renderer->WorldToView(fLocalExtents[1], fLocalExtents[3], fLocalExtents[5]);
1181 for(int i=0; i<3; i++) {
1182 if (i!=SliceOrientation) { //SR: assumes that SliceOrientation is valid in ViewCoordinates (???)
1183 fLocalExtents[i*2 ] -= 0.2;
1184 fLocalExtents[i*2+1] += 0.2;
1187 this->Renderer->ViewToWorld(fLocalExtents[0], fLocalExtents[2], fLocalExtents[4]);
1188 this->Renderer->ViewToWorld(fLocalExtents[1], fLocalExtents[3], fLocalExtents[5]);
1190 //Convert to image pixel coordinates (rounded)
1191 int iLocalExtents[6];
1192 for(int i=0; i<3; i++) {
1193 fLocalExtents[i*2 ] = (fLocalExtents[i*2 ] - image->GetOrigin()[i])/image->GetSpacing()[i];
1194 fLocalExtents[i*2+1] = (fLocalExtents[i*2+1] - image->GetOrigin()[i])/image->GetSpacing()[i];
1196 iLocalExtents[i*2 ] = lrint(fLocalExtents[i*2 ]);
1197 iLocalExtents[i*2+1] = lrint(fLocalExtents[i*2+1]);
1199 if(iLocalExtents[i*2 ]>iLocalExtents[i*2+1])
1200 std::swap(iLocalExtents[i*2], iLocalExtents[i*2+1]);
1203 vtkSmartPointer<vtkExtractVOI> voiFilter = vtkSmartPointer<vtkExtractVOI>::New();
1204 voiFilter->SetInput(image);
1205 voiFilter->SetVOI(iLocalExtents);
1206 voiFilter->Update();
1207 if (!voiFilter->GetOutput()->GetNumberOfPoints()) {
1213 vtkSmartPointer<vtkImageAccumulate> accFilter = vtkSmartPointer<vtkImageAccumulate>::New();
1214 accFilter->SetInput(voiFilter->GetOutput());
1215 accFilter->Update();
1217 min = *(accFilter->GetMin());
1218 max = *(accFilter->GetMax());
1220 //----------------------------------------------------------------------------
1222 //----------------------------------------------------------------------------
1223 double vvSlicer::GetScalarComponentAsDouble(vtkImageData *image, double X, double Y, double Z, int &ix, int &iy, int &iz, int component)
1228 if (ix < image->GetWholeExtent()[0] ||
1229 ix > image->GetWholeExtent()[1] ||
1230 iy < image->GetWholeExtent()[2] ||
1231 iy > image->GetWholeExtent()[3] ||
1232 iz < image->GetWholeExtent()[4] ||
1233 iz > image->GetWholeExtent()[5] )
1234 return std::numeric_limits<double>::quiet_NaN();
1236 image->SetUpdateExtent(ix, ix, iy, iy, iz, iz);
1238 return image->GetScalarComponentAsDouble(ix, iy, iz, component);
1240 //----------------------------------------------------------------------------
1242 //----------------------------------------------------------------------------
1243 void vvSlicer::Render()
1245 if (this->mFusion && showFusionLegend) {
1246 legend->SetLookupTable(this->GetFusionMapper()->GetLookupTable());
1247 legend->UseOpacityOn();
1248 legend->SetVisibility(1);
1250 else if (this->GetWindowLevel()->GetLookupTable()) {// && !this->mOverlay && !this->mFusion) {
1251 legend->SetLookupTable(this->GetWindowLevel()->GetLookupTable());
1252 legend->UseOpacityOff();
1253 legend->SetVisibility(1);
1254 } else legend->SetVisibility(0);
1256 if (ca->GetVisibility()) {
1257 std::stringstream worldPos;
1258 double X = (mCurrent[0] - this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
1259 double Y = (mCurrent[1] - this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
1260 double Z = (mCurrent[2] - this->GetInput()->GetOrigin()[2])/this->GetInput()->GetSpacing()[2];
1262 // if (X < this->GetInput()->GetWholeExtent()[0]) X = this->GetInput()->GetWholeExtent()[0];
1263 // else if (X > this->GetInput()->GetWholeExtent()[1]) X = this->GetInput()->GetWholeExtent()[1];
1264 // if (Y < this->GetInput()->GetWholeExtent()[2]) Y = this->GetInput()->GetWholeExtent()[2];
1265 // else if (Y > this->GetInput()->GetWholeExtent()[3]) Y = this->GetInput()->GetWholeExtent()[3];
1266 // if (Z < this->GetInput()->GetWholeExtent()[4]) Z = this->GetInput()->GetWholeExtent()[4];
1267 // else if (Z > this->GetInput()->GetWholeExtent()[5]) Z = this->GetInput()->GetWholeExtent()[5];
1269 if (X >= this->GetInput()->GetWholeExtent()[0] &&
1270 X <= this->GetInput()->GetWholeExtent()[1] &&
1271 Y >= this->GetInput()->GetWholeExtent()[2] &&
1272 Y <= this->GetInput()->GetWholeExtent()[3] &&
1273 Z >= this->GetInput()->GetWholeExtent()[4] &&
1274 Z <= this->GetInput()->GetWholeExtent()[5]) {
1278 double value = this->GetScalarComponentAsDouble(this->GetInput(), X, Y, Z, ix, iy, iz);
1280 if(ImageActor->GetVisibility())
1281 worldPos << "data value : " << value << std::endl;
1283 worldPos << "mm : " << lrint(mCurrent[0]) << ' '
1284 << lrint(mCurrent[1]) << ' '
1285 << lrint(mCurrent[2]) << ' '
1288 worldPos << "pixel : " << ix << ' '
1294 ca->SetText(1,worldPos.str().c_str());
1297 if (pdmA->GetVisibility()) {
1298 double x = mCursor[0];
1299 double y = mCursor[1];
1300 double z = mCursor[2];
1301 double xCursor = (x - this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
1302 double yCursor = (y - this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
1303 double zCursor = (z - this->GetInput()->GetOrigin()[2])/this->GetInput()->GetSpacing()[2];
1305 if (xCursor >= this->GetImageActor()->GetDisplayExtent()[0] &&
1306 xCursor < this->GetImageActor()->GetDisplayExtent()[1]+1 &&
1307 yCursor >= this->GetImageActor()->GetDisplayExtent()[2] &&
1308 yCursor < this->GetImageActor()->GetDisplayExtent()[3]+1 &&
1309 zCursor >= this->GetImageActor()->GetDisplayExtent()[4] &&
1310 zCursor < this->GetImageActor()->GetDisplayExtent()[5]+1 ) {
1311 vtkRenderer * renderer = this->Renderer;
1313 renderer->WorldToView(x,y,z);
1314 renderer->ViewToNormalizedViewport(x,y,z);
1315 renderer->NormalizedViewportToViewport(x,y);
1316 renderer->ViewportToNormalizedDisplay(x,y);
1317 renderer->NormalizedDisplayToDisplay(x,y);
1318 crossCursor->SetFocalPoint(x,y,z);
1320 crossCursor->SetFocalPoint(-1,-1,z);
1324 if (mOverlay && mOverlayActor->GetVisibility()) {
1325 if(mLinkOverlayWindowLevel) {
1326 mOverlayMapper->SetWindow(this->GetColorWindow());
1327 mOverlayMapper->SetLevel(this->GetColorLevel());
1329 mOverlayMapper->GetOutput()->SetUpdateExtent(mOverlayActor->GetDisplayExtent());
1330 mOverlayMapper->GetOutput()->Update();
1331 mOverlayMapper->Update();
1336 this->GetRenderWindow()->Render();
1338 //----------------------------------------------------------------------------
1341 //----------------------------------------------------------------------------
1342 void vvSlicer::UpdateCursorPosition()
1344 pdmA->SetVisibility(true);
1345 mCursor[0] = mCurrent[0];
1346 mCursor[1] = mCurrent[1];
1347 mCursor[2] = mCurrent[2];
1348 mCursor[3] = mCurrentTSlice;
1350 //----------------------------------------------------------------------------
1353 //----------------------------------------------------------------------------
1354 void vvSlicer::UpdateLandmarks()
1356 vtkPolyData *pd = static_cast<vtkPolyData*>(mLandClipper->GetInput());
1357 if (pd->GetPoints()) {
1358 mLandGlyph->SetRange(0,1);
1359 mLandGlyph->Modified();
1360 mLandGlyph->Update();
1362 mClipBox->Modified();
1363 mLandClipper->Update();
1364 mLandMapper->Update();
1368 //----------------------------------------------------------------------------
1371 //----------------------------------------------------------------------------
1372 void vvSlicer::SetSlice(int slice)
1374 int *range = this->GetSliceRange();
1376 if (slice < range[0]) {
1378 } else if (slice > range[1]) {
1383 if (this->Slice == slice) {
1387 this->Slice = slice;
1390 this->UpdateDisplayExtent();
1392 // Seems to work without this line
1395 //----------------------------------------------------------------------------
1398 //----------------------------------------------------------------------------
1399 void vvSlicer::SetContourSlice()
1401 if (mSurfaceCutActors.size() > 0)
1402 for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
1403 i!=mSurfaceCutActors.end(); i++) {
1405 (*i)->SetSlicingOrientation(this->SliceOrientation);
1406 (*i)->SetCutSlice((this->Slice)*this->GetImage()->GetSpacing()[this->SliceOrientation]+
1407 this->GetImage()->GetOrigin()[this->SliceOrientation]);
1410 //----------------------------------------------------------------------------
1413 //----------------------------------------------------------------------------
1414 void vvSlicer::ForceUpdateDisplayExtent()
1416 this->UpdateDisplayExtent();
1418 //----------------------------------------------------------------------------
1421 //----------------------------------------------------------------------------
1422 int* vvSlicer::GetDisplayExtent()
1424 return this->GetImageActor()->GetDisplayExtent();
1426 //----------------------------------------------------------------------------
1429 //----------------------------------------------------------------------------
1430 void vvSlicer::PrintSelf(ostream& os, vtkIndent indent)
1432 this->Superclass::PrintSelf(os, indent);
1434 //----------------------------------------------------------------------------
1436 //----------------------------------------------------------------------------
1437 void vvSlicer::SetVFColor(double r, double g, double b)
1439 double mVFColorHSV[3];
1444 vtkMath::RGBToHSV(mVFColor, mVFColorHSV);
1445 mVFColorLUT->SetHueRange(mVFColorHSV[0], mVFColorHSV[0]);
1446 mVFColorLUT->SetSaturationRange(mVFColorHSV[1],mVFColorHSV[1]);
1447 mVFColorLUT->SetValueRange(mVFColorHSV[2], mVFColorHSV[2]);