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 ===========================================================================**/
19 #include <QMessageBox>
24 #include "vvSlicerManagerCommand.h"
25 #include "vvGlyphSource.h"
26 #include "vvGlyph2D.h"
28 #include <vtkVersion.h>
29 #include <vtkExtentTranslator.h>
30 #include <vtkAlgorithm.h>
31 #include <vtkExecutive.h>
32 #include <vtkStreamingDemandDrivenPipeline.h>
33 #include <vtkInformation.h>
34 #include <vtkTextProperty.h>
35 #include <vtkTextActor.h>
36 #include <vtkTextSource.h>
37 #include <vtkActor2D.h>
38 #include <vtkCursor2D.h>
39 #include <vtkPolyDataMapper2D.h>
40 #include <vtkProperty2D.h>
41 #include <vtkCornerAnnotation.h>
42 #include <vtkImageMapToWindowLevelColors.h>
43 #include <vtkImageData.h>
44 #include <vtkImageActor.h>
45 #include <vvBlendImageActor.h>
46 #include <vtkToolkits.h>
47 #include <vtkObjectFactory.h>
48 #include <vtkPointData.h>
49 #include <vtkDataArray.h>
50 #include <vtkFloatArray.h>
51 #include <vtkClipPolyData.h>
52 #include <vtkActor2DCollection.h>
53 #include <vtkGlyph3D.h>
55 #include <vtkCursor3D.h>
56 #include <vtkProperty.h>
58 #include <vtkLightCollection.h>
59 #include <vtkScalarBarActor.h>
60 #include <vtkLookupTable.h>
62 #include <vtkRenderer.h>
63 #include <vtkRendererCollection.h>
64 #include <vtkRenderWindow.h>
65 #include <vtkRenderWindowInteractor.h>
66 #include <vtkCamera.h>
67 #include <vtkCallbackCommand.h>
68 #include <vtkCommand.h>
69 #include <vtkPolyDataMapper.h>
72 #include <vtkExtractVOI.h>
73 #include <vtkSphereSource.h>
74 #include <vtkCutter.h>
75 #include <vtkAssignAttribute.h>
76 #include <vtkImageAccumulate.h>
77 #include <vtkImageReslice.h>
78 #include <vtkOpenGLImageSliceMapper.h>
79 #if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
80 # include <vtkImageMapper3D.h>
81 # include <vtkImageSliceMapper.h>
84 vtkStandardNewMacro(vvSlicer);
85 static void copyExtent(int* in, int* to){
86 for(int i=0; i<6; ++i)
91 //------------------------------------------------------------------------------
93 { //out << __func__ << endl;
94 mFusionSequenceCode = -1;
95 this->UnInstallPipeline();
97 mReducedExtent = new int[6];
98 mRegisterExtent = NULL;
100 mCurrentFusionTSlice = 0;
101 mCurrentOverlayTSlice = 0;
102 mUseReducedExtent = false;
104 mCurrent[0] = -VTK_DOUBLE_MAX;
105 mCurrent[1] = -VTK_DOUBLE_MAX;
106 mCurrent[2] = -VTK_DOUBLE_MAX;
108 mCursor[0] = 0;//-VTK_DOUBLE_MAX;
109 mCursor[1] = 0;//-VTK_DOUBLE_MAX;
110 mCursor[2] = 0;//-VTK_DOUBLE_MAX;
111 mCursor[3] = 0;//-VTK_DOUBLE_MAX;
121 crossCursor = vtkSmartPointer<vtkCursor2D>::New();
122 crossCursor->AllOff();
123 crossCursor->AxesOn();
124 crossCursor->SetTranslationMode(1);
125 crossCursor->SetRadius(2);
127 pdm = vtkSmartPointer<vtkPolyDataMapper2D>::New();
128 #if VTK_MAJOR_VERSION <= 5
129 pdm->SetInput(crossCursor->GetOutput());
131 pdm->SetInputConnection(crossCursor->GetOutputPort(0));
134 pdmA = vtkSmartPointer<vtkActor2D>::New();
135 pdmA->SetMapper(pdm);
136 pdmA->GetProperty()->SetColor(255,10,212);
137 pdmA->SetVisibility(0);
138 pdmA->SetPickable(0);
140 ca = vtkSmartPointer<vtkCornerAnnotation>::New();
141 ca->GetTextProperty()->SetColor(255,10,212);
142 ca->SetVisibility(1);
150 legend = vtkSmartPointer<vtkScalarBarActor>::New();
151 //legend->SetTitle("test!");
152 legend->SetPosition(0.82,0.18);
153 legend->SetWidth(0.1);
154 legend->SetVisibility(0);
155 legend->SetLabelFormat("%.1f");
156 this->GetRenderer()->AddActor(legend);
157 showFusionLegend = false;
159 this->InstallPipeline();
161 mLinkOverlayWindowLevel = true;
162 mImageVisibility = true;
164 #if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
165 this->GetImageActor()->GetMapper()->BorderOn();
168 mSlicingTransform = vtkSmartPointer<vtkTransform>::New();
169 mConcatenatedTransform = vtkSmartPointer<vtkTransform>::New();
170 mConcatenatedFusionTransform = vtkSmartPointer<vtkTransform>::New();
171 mConcatenatedOverlayTransform = vtkSmartPointer<vtkTransform>::New();
172 mFirstSetSliceOrientation = true;
174 //------------------------------------------------------------------------------
177 //------------------------------------------------------------------------------
178 vtkImageMapToWindowLevelColors* vvSlicer::GetOverlayMapper()
179 { //out << __func__ << endl;
180 return mOverlayMapper.GetPointer();
182 //------------------------------------------------------------------------------
185 //------------------------------------------------------------------------------
186 vvBlendImageActor* vvSlicer::GetOverlayActor()
187 { //out << __func__ << endl;
188 return mOverlayActor.GetPointer();
190 //------------------------------------------------------------------------------
193 //------------------------------------------------------------------------------
194 vtkImageMapToColors* vvSlicer::GetFusionMapper()
195 { //out << __func__ << endl;
196 return mFusionMapper.GetPointer();
198 //------------------------------------------------------------------------------
201 //------------------------------------------------------------------------------
202 vtkImageActor* vvSlicer::GetFusionActor()
203 { //out << __func__ << endl;
204 return mFusionActor.GetPointer();
206 //------------------------------------------------------------------------------
209 //------------------------------------------------------------------------------
210 vtkActor* vvSlicer::GetVFActor()
211 { //out << __func__ << endl;
212 return mVFActor.GetPointer();
214 //------------------------------------------------------------------------------
217 //------------------------------------------------------------------------------
218 vtkCornerAnnotation* vvSlicer::GetAnnotation()
219 { //out << __func__ << endl;
220 return ca.GetPointer();
222 //------------------------------------------------------------------------------
225 //------------------------------------------------------------------------------
226 void vvSlicer::EnableReducedExtent(bool b)
227 { //out << __func__ << endl;
228 mUseReducedExtent = b;
230 //------------------------------------------------------------------------------
233 //------------------------------------------------------------------------------
234 void vvSlicer::SetReducedExtent(int * ext)
235 { //out << __func__ << endl;
236 copyExtent(ext, mReducedExtent);
238 //------------------------------------------------------------------------------
241 //------------------------------------------------------------------------------
242 void vvSlicer::AddContour(vvMesh::Pointer contour,bool propagate)
243 { //out << __func__ << endl;
245 mSurfaceCutActors.push_back(new vvMeshActor());
247 mSurfaceCutActors.back()->Init(contour,mCurrentTSlice,mVF);
249 mSurfaceCutActors.back()->Init(contour,mCurrentTSlice);
250 mSurfaceCutActors.back()->SetSlicingOrientation(SliceOrientation);
251 this->GetRenderer()->AddActor(mSurfaceCutActors.back()->GetActor());
255 //------------------------------------------------------------------------------
258 //------------------------------------------------------------------------------
259 void vvSlicer::ToggleContourSuperposition()
260 { //out << __func__ << endl;
261 for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
262 i!=mSurfaceCutActors.end(); i++)
263 (*i)->ToggleSuperposition();
265 //------------------------------------------------------------------------------
268 //------------------------------------------------------------------------------
269 void vvSlicer::SetCursorColor(int r,int g, int b)
270 { //out << __func__ << endl;
271 pdmA->GetProperty()->SetColor(r,g,b);
273 //------------------------------------------------------------------------------
276 //------------------------------------------------------------------------------
277 void vvSlicer::SetCursorVisibility(bool s)
278 { //out << __func__ << endl;
279 pdmA->SetVisibility(s);
281 //------------------------------------------------------------------------------
284 //------------------------------------------------------------------------------
285 bool vvSlicer::GetCursorVisibility()
286 { //out << __func__ << endl;
287 return pdmA->GetVisibility();
289 //------------------------------------------------------------------------------
292 //------------------------------------------------------------------------------
293 void vvSlicer::SetCornerAnnotationVisibility(bool s)
294 { //out << __func__ << endl;
295 ca->SetVisibility(s);
297 //------------------------------------------------------------------------------
300 //------------------------------------------------------------------------------
301 bool vvSlicer::GetCornerAnnotationVisibility()
302 { //out << __func__ << endl;
303 return ca->GetVisibility();
305 //------------------------------------------------------------------------------
308 //------------------------------------------------------------------------------
309 vvSlicer::~vvSlicer()
310 { //out << __func__ << endl;
311 for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
312 i!=mSurfaceCutActors.end(); i++)
314 delete [] mReducedExtent;
316 //------------------------------------------------------------------------------
318 //------------------------------------------------------------------------------
319 double* vvSlicer::GetCurrentPosition()
320 { //out << __func__ << endl;
321 return mCurrentBeforeSlicingTransform;
323 //------------------------------------------------------------------------------
325 //------------------------------------------------------------------------------
326 void vvSlicer::SetCurrentPosition(double x, double y, double z, int t)
327 { //out << __func__ << endl;
328 mCurrentBeforeSlicingTransform[0]=x;
329 mCurrentBeforeSlicingTransform[1]=y;
330 mCurrentBeforeSlicingTransform[2]=z;
331 mSlicingTransform->GetInverse()->TransformPoint(mCurrentBeforeSlicingTransform,mCurrent);
332 if (t>=0) SetTSlice(t);
334 //------------------------------------------------------------------------------
337 //------------------------------------------------------------------------------
338 void vvSlicer::SetImage(vvImage::Pointer image)
339 { //out << __func__ << endl;
340 if (image->GetVTKImages().size()) {
343 if (!mImageReslice) {
344 mImageReslice = vtkSmartPointer<vtkImageReslice>::New();
345 mImageReslice->SetInterpolationModeToLinear();
346 mImageReslice->AutoCropOutputOn();
347 mImageReslice->SetBackgroundColor(-1000,-1000,-1000,1);
350 mConcatenatedTransform->Identity();
351 mConcatenatedTransform->Concatenate(mImage->GetTransform()[0]);
352 mConcatenatedTransform->Concatenate(mSlicingTransform);
353 mImageReslice->SetResliceTransform(mConcatenatedTransform);
354 #if VTK_MAJOR_VERSION <= 5
355 mImageReslice->SetInput(0, mImage->GetFirstVTKImageData());
357 mImageReslice->SetInputData(0, mImage->GetFirstVTKImageData());
359 mImageReslice->UpdateInformation();
361 #if VTK_MAJOR_VERSION <= 5
362 this->Superclass::SetInput(mImageReslice->GetOutput());
364 this->Superclass::SetInputConnection(mImageReslice->GetOutputPort());
368 #if VTK_MAJOR_VERSION <= 5
369 this->GetInput()->GetWholeExtent(extent);
371 int* ext = mImageReslice->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());
372 copyExtent(ext, extent);
375 // Prevent crash when reload -> change slice if outside extent
376 if (Slice < extent[SliceOrientation*2] || Slice>=extent[SliceOrientation*2+1]) {
377 Slice = (extent[SliceOrientation*2+1]+extent[SliceOrientation*2])/2.0;
380 // Make sure that the required part image has been computed
381 extent[SliceOrientation*2] = Slice;
382 extent[SliceOrientation*2+1] = Slice;
384 #if VTK_MAJOR_VERSION <= 5
385 mImageReslice->GetOutput()->SetUpdateExtent(extent);
386 mImageReslice->GetOutput()->Update();
388 mImageReslice->SetUpdateExtent(extent);
389 mImageReslice->Update();
392 this->UpdateDisplayExtent();
395 ca->SetText(0,mFileName.c_str());
398 //------------------------------------------------------------------------------
401 //------------------------------------------------------------------------------
402 void vvSlicer::SetOverlay(vvImage::Pointer overlay)
403 { //out << __func__ << endl;
404 if (overlay->GetVTKImages().size()) {
406 mOverlayVisibility = true;
408 if (!mOverlayReslice) {
409 mOverlayReslice = vtkSmartPointer<vtkImageReslice>::New();
410 mOverlayReslice->SetInterpolationModeToLinear();
411 mOverlayReslice->AutoCropOutputOn();
412 mOverlayReslice->SetBackgroundColor(-1000,-1000,-1000,1);
415 mConcatenatedOverlayTransform->Identity();
416 mConcatenatedOverlayTransform->Concatenate(mOverlay->GetTransform()[0]);
417 mConcatenatedOverlayTransform->Concatenate(mSlicingTransform);
418 mOverlayReslice->SetResliceTransform(mConcatenatedOverlayTransform);
419 #if VTK_MAJOR_VERSION <= 5
420 mOverlayReslice->SetInput(0, mOverlay->GetFirstVTKImageData());
422 mOverlayReslice->SetInputData(0, mOverlay->GetFirstVTKImageData());
424 mOverlayReslice->Update();
427 mOverlayMapper = vtkSmartPointer<vtkImageMapToWindowLevelColors>::New();
428 #if VTK_MAJOR_VERSION <= 5
429 mOverlayMapper->SetInput(mOverlayReslice->GetOutput());
431 mOverlayMapper->SetInputConnection(mOverlayReslice->GetOutputPort(0));
434 if (!mOverlayActor) {
435 mOverlayActor = vtkSmartPointer<vvBlendImageActor>::New();
436 #if VTK_MAJOR_VERSION <= 5
437 mOverlayActor->SetInput(mOverlayMapper->GetOutput());
439 mOverlayActor->GetMapper()->SetInputConnection(mOverlayMapper->GetOutputPort());
441 mOverlayActor->SetPickable(0);
442 mOverlayActor->SetVisibility(true);
443 mOverlayActor->SetOpacity(0.5);
444 #if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
445 mOverlayActor->GetMapper()->BorderOn();
449 //stupid but necessary : the Overlay need to be rendered before fusion
451 this->GetRenderer()->RemoveActor(mFusionActor);
452 this->GetRenderer()->AddActor(mOverlayActor);
453 this->GetRenderer()->AddActor(mFusionActor);
455 this->GetRenderer()->AddActor(mOverlayActor);
457 //Synchronize orientation and slice
458 AdjustResliceToSliceOrientation(mOverlayReslice);
459 this->UpdateDisplayExtent();
460 this->SetTSlice(mCurrentTSlice);
463 //------------------------------------------------------------------------------
466 //------------------------------------------------------------------------------
467 void vvSlicer::SetFusion(vvImage::Pointer fusion, int fusionSequenceCode)
468 { //out << __func__ << endl;
469 mFusionSequenceCode = fusionSequenceCode;
470 if (fusion->GetVTKImages().size()) {
472 mFusionVisibility = true;
474 if (!mFusionReslice) {
475 mFusionReslice = vtkSmartPointer<vtkImageReslice>::New();
476 mFusionReslice->SetInterpolationModeToLinear();
477 mFusionReslice->AutoCropOutputOn();
478 mFusionReslice->SetBackgroundColor(-1000,-1000,-1000,1);
481 mConcatenatedFusionTransform->Identity();
482 mConcatenatedFusionTransform->Concatenate(mFusion->GetTransform()[0]);
483 mConcatenatedFusionTransform->Concatenate(mSlicingTransform);
484 mFusionReslice->SetResliceTransform(mConcatenatedFusionTransform);
485 #if VTK_MAJOR_VERSION <= 5
486 mFusionReslice->SetInput(0, mFusion->GetFirstVTKImageData());
488 mFusionReslice->SetInputData(0, mFusion->GetFirstVTKImageData());
490 mFusionReslice->Update();
493 mFusionMapper = vtkSmartPointer<vtkImageMapToColors>::New();
495 vtkSmartPointer<vtkLookupTable> lut = vtkLookupTable::New();
497 lut->SetValueRange(0, 1);
498 lut->SetSaturationRange(0, 0);
500 mFusionMapper->SetLookupTable(lut);
501 #if VTK_MAJOR_VERSION <= 5
502 mFusionMapper->SetInput(mFusionReslice->GetOutput());
504 mFusionMapper->SetInputConnection(mFusionReslice->GetOutputPort(0));
508 mFusionActor = vtkSmartPointer<vtkImageActor>::New();
509 #if VTK_MAJOR_VERSION <= 5
510 mFusionActor->SetInput(mFusionMapper->GetOutput());
512 mFusionActor->GetMapper()->SetInputConnection(mFusionMapper->GetOutputPort());
514 mFusionActor->SetPickable(0);
515 mFusionActor->SetVisibility(true);
516 mFusionActor->SetOpacity(0.7);
517 #if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
518 mFusionActor->GetMapper()->BorderOn();
521 this->GetRenderer()->AddActor(mFusionActor);
524 //Synchronize orientation and slice
525 AdjustResliceToSliceOrientation(mFusionReslice);
526 this->UpdateDisplayExtent();
527 this->SetTSlice(mCurrentTSlice);
530 //------------------------------------------------------------------------------
533 //------------------------------------------------------------------------------
534 bool vvSlicer::GetActorVisibility(const std::string& actor_type, int overlay_index)
535 { //out << __func__ << endl;
537 if (actor_type == "image")
538 vis = mImageVisibility;
539 else if (actor_type == "vector")
541 else if (actor_type == "overlay")
542 vis = mOverlayVisibility;
543 else if ( (actor_type == "fusion") || (actor_type == "fusionSequence") )
544 vis = mFusionVisibility;
545 else if (actor_type == "contour")
546 vis = this->mSurfaceCutActors[overlay_index]->GetActor()->GetVisibility();
549 //------------------------------------------------------------------------------
551 //------------------------------------------------------------------------------
552 void vvSlicer::SetActorVisibility(const std::string& actor_type, int overlay_index ,bool vis)
553 { //out << __func__ << endl;
554 if (actor_type == "image")
555 mImageVisibility = vis;
556 else if (actor_type == "vector")
558 else if (actor_type == "overlay")
559 mOverlayVisibility = vis;
560 else if ( (actor_type == "fusion") || (actor_type == "fusionSequence") )
561 mFusionVisibility = vis;
562 else if (actor_type == "contour")
563 this->mSurfaceCutActors[overlay_index]->GetActor()->SetVisibility(vis);
564 UpdateDisplayExtent();
566 //------------------------------------------------------------------------------
568 //------------------------------------------------------------------------------
569 void vvSlicer::SetVF(vvImage::Pointer vf)
570 { //out << __func__ << endl;
571 if (vf->GetVTKImages().size()) {
573 mVFVisibility = true;
576 mAAFilter= vtkSmartPointer<vtkAssignAttribute>::New();
577 mVOIFilter = vtkSmartPointer<vtkExtractVOI>::New();
578 mVOIFilter->SetSampleRate(mSubSampling,mSubSampling,mSubSampling);
580 #if VTK_MAJOR_VERSION <= 5
581 mVOIFilter->SetInput(vf->GetFirstVTKImageData());
582 mAAFilter->SetInput(mVOIFilter->GetOutput());
584 mVOIFilter->SetInputData(vf->GetFirstVTKImageData());
585 mAAFilter->SetInputConnection(mVOIFilter->GetOutputPort());
587 ///This tells VTK to use the scalar (pixel) data of the image to draw the little arrows
588 mAAFilter->Assign(vtkDataSetAttributes::SCALARS, vtkDataSetAttributes::VECTORS, vtkAssignAttribute::POINT_DATA);
591 mArrow = vtkSmartPointer<vvGlyphSource>::New();
592 mArrow->SetGlyphTypeToSpecificArrow();
593 mArrow->SetScale(mScale);
596 // Glyph the gradient vector (with arrows)
598 mGlyphFilter = vtkSmartPointer<vvGlyph2D>::New();
599 #if VTK_MAJOR_VERSION <= 5
600 mGlyphFilter->SetInput(mAAFilter->GetOutput());
601 mGlyphFilter->SetSource(mArrow->GetOutput());
603 mGlyphFilter->SetInputConnection(mAAFilter->GetOutputPort());
604 mGlyphFilter->SetSourceConnection(mArrow->GetOutputPort());
606 mGlyphFilter->ScalingOn();
607 mGlyphFilter->SetScaleModeToScaleByVector();
608 mGlyphFilter->OrientOn();
609 mGlyphFilter->SetVectorModeToUseVector();
610 mGlyphFilter->SetColorModeToColorByVector();
613 mVFColorLUT = vtkSmartPointer<vtkLookupTable>::New();
615 double mVFColorHSV[3];
616 vtkMath::RGBToHSV(mVFColor, mVFColorHSV);
617 mVFColorLUT->SetHueRange(mVFColorHSV[0], mVFColorHSV[0]);
618 mVFColorLUT->SetSaturationRange(mVFColorHSV[1],mVFColorHSV[1]);
619 mVFColorLUT->SetValueRange(mVFColorHSV[2], mVFColorHSV[2]);
622 mVFMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
623 #if VTK_MAJOR_VERSION <= 5
624 mVFMapper->SetInput(mGlyphFilter->GetOutput());
626 mVFMapper->SetInputConnection(mGlyphFilter->GetOutputPort());
628 mVFMapper->ImmediateModeRenderingOn();
629 mVFMapper->SetLookupTable(mVFColorLUT);
632 mVFActor = vtkSmartPointer<vtkActor>::New();
633 mVFActor->SetMapper(mVFMapper);
634 mVFActor->SetPickable(0);
635 mVFActor->GetProperty()->SetLineWidth(mVFWidth);
636 this->UpdateDisplayExtent();
637 this->GetRenderer()->AddActor(mVFActor);
640 SetTSlice(mCurrentTSlice);
643 //------------------------------------------------------------------------------
646 //------------------------------------------------------------------------------
647 void vvSlicer::SetLandmarks(vvLandmarks* landmarks)
648 { //out << __func__ << endl;
649 mLandmarks = landmarks;
653 mCross = vtkSmartPointer<vtkCursor3D>::New();
655 mClipBox = vtkSmartPointer<vtkBox>::New();
657 mLandClipper = vtkSmartPointer<vvClipPolyData>::New();
659 mLandGlyph = vtkSmartPointer<vtkGlyph3D>::New();
661 mLandMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
663 mLandActor = vtkSmartPointer<vtkActor>::New();
665 mCross->SetFocalPoint(0.0,0.0,0.0);
666 mCross->SetModelBounds(-10,10,-10,10,-10,10);
670 mLandClipper->SetClipFunction(mClipBox);
671 mLandClipper->InsideOutOn();
672 #if VTK_MAJOR_VERSION <= 5
673 mLandClipper->SetInput(mLandmarks->GetOutput());
675 mLandGlyph->SetSource(mCross->GetOutput());
676 mLandGlyph->SetInput(mLandClipper->GetOutput());
678 mLandClipper->SetInputData(mLandmarks->GetOutput());
680 mLandGlyph->SetSourceConnection(mCross->GetOutputPort());
681 mLandGlyph->SetInputConnection(mLandClipper->GetOutputPort());
683 //mLandGlyph->SetIndexModeToScalar();
684 //mLandGlyph->SetRange(0,1);
685 //mLandGlyph->ScalingOff();
687 //mLandGlyph->SetColorModeToColorByScalar();
689 mLandGlyph->SetScaleModeToDataScalingOff();
690 mLandGlyph->SetIndexModeToOff();
692 mLandMapper->SetInputConnection(mLandGlyph->GetOutputPort());
693 //mLandMapper->ScalarVisibilityOff();
695 mLandActor->SetMapper(mLandMapper);
696 mLandActor->GetProperty()->SetOpacity(0.995);
697 mLandActor->GetProperty()->SetColor(255,10,212);
698 mLandActor->SetPickable(0);
699 mLandActor->SetVisibility(true);
700 this->UpdateDisplayExtent();
701 this->GetRenderer()->AddActor(mLandActor);
704 //------------------------------------------------------------------------------
706 //------------------------------------------------------------------------------
707 //FIXME: this function leaks memory, we should fix it someday :)
708 void vvSlicer::RemoveActor(const std::string& actor_type, int overlay_index)
709 { //out << __func__ << endl;
710 if (actor_type == "vector") {
711 Renderer->RemoveActor(mVFActor);
720 if (actor_type == "overlay") {
721 Renderer->RemoveActor(mOverlayActor);
723 mOverlayActor = NULL;
724 mOverlayMapper = NULL;
726 if ( (actor_type == "fusion") || (actor_type == "fusionSequence") ) {
727 Renderer->RemoveActor(mFusionActor);
730 mFusionMapper = NULL;
732 if (actor_type == "contour") {
733 Renderer->RemoveActor(this->mSurfaceCutActors[overlay_index]->GetActor());
734 mSurfaceCutActors.erase(mSurfaceCutActors.begin()+overlay_index);
737 //------------------------------------------------------------------------------
740 //------------------------------------------------------------------------------
741 void vvSlicer::SetVFSubSampling(int sub)
742 { //out << __func__ << endl;
744 mVOIFilter->SetSampleRate(mSubSampling,mSubSampling,mSubSampling);
747 UpdateDisplayExtent();
750 //------------------------------------------------------------------------------
753 //------------------------------------------------------------------------------
754 void vvSlicer::SetVFScale(int scale)
755 { //out << __func__ << endl;
758 mArrow->SetScale(mScale);
759 UpdateDisplayExtent();
762 //------------------------------------------------------------------------------
764 //------------------------------------------------------------------------------
765 void vvSlicer::SetVFWidth(int width)
766 { //out << __func__ << endl;
769 mVFActor->GetProperty()->SetLineWidth(mVFWidth);
770 UpdateDisplayExtent();
773 //------------------------------------------------------------------------------
776 //------------------------------------------------------------------------------
777 void vvSlicer::SetVFLog(int log)
778 { //out << __func__ << endl;
781 mGlyphFilter->SetUseLog(mVFLog);
782 mGlyphFilter->Modified();
784 UpdateDisplayExtent();
787 //------------------------------------------------------------------------------
790 //------------------------------------------------------------------------------
791 void vvSlicer::SetTSlice(int t, bool updateLinkedImages)
792 { //out << __func__ << endl;
793 if (!updateLinkedImages) {
795 #if VTK_MAJOR_VERSION <= 5
796 mImageReslice->SetInput( mImage->GetVTKImages()[mCurrentTSlice] );
798 mImageReslice->SetInputData( mImage->GetVTKImages()[mCurrentTSlice] );
801 mConcatenatedTransform->Identity();
802 mConcatenatedTransform->Concatenate(mImage->GetTransform()[mCurrentTSlice]);
803 mConcatenatedTransform->Concatenate(mSlicingTransform);
804 UpdateDisplayExtent();
809 else if ((unsigned int)t >= mImage->GetVTKImages().size())
810 mCurrentTSlice = mImage->GetVTKImages().size() -1;
815 mConcatenatedTransform->Identity();
816 mConcatenatedTransform->Concatenate(mImage->GetTransform()[mCurrentTSlice]);
817 mConcatenatedTransform->Concatenate(mSlicingTransform);
820 #if VTK_MAJOR_VERSION <= 5
821 mImageReslice->SetInput( mImage->GetVTKImages()[mCurrentTSlice] );
823 mImageReslice->SetInputData( mImage->GetVTKImages()[mCurrentTSlice] );
825 if (mVF && mVFActor->GetVisibility()) {
826 if (mVF->GetVTKImages().size() > (unsigned int)mCurrentTSlice)
827 #if VTK_MAJOR_VERSION <= 5
828 mVOIFilter->SetInput(mVF->GetVTKImages()[mCurrentTSlice]);
830 mVOIFilter->SetInputData(mVF->GetVTKImages()[mCurrentTSlice]);
834 if (mOverlay && mOverlayActor->GetVisibility()) {
835 if (mOverlay->GetVTKImages().size() > (unsigned int)t) {
836 mCurrentOverlayTSlice = t;
837 #if VTK_MAJOR_VERSION <= 5
838 mOverlayReslice->SetInput( mOverlay->GetVTKImages()[mCurrentOverlayTSlice] );
840 mOverlayReslice->SetInputData( mOverlay->GetVTKImages()[mCurrentOverlayTSlice] );
842 // Update overlay transform
843 mConcatenatedOverlayTransform->Identity();
844 mConcatenatedOverlayTransform->Concatenate(mOverlay->GetTransform()[mCurrentOverlayTSlice]);
845 mConcatenatedOverlayTransform->Concatenate(mSlicingTransform);
848 //update the fusion ; except in case this is a fusionSequence, in which case both 'times' should be independent.
849 if (mFusion && mFusionActor->GetVisibility() && (mFusionSequenceCode<0)) {
850 if (mFusion->GetVTKImages().size() > (unsigned int)t) {
851 mCurrentFusionTSlice = t;
852 #if VTK_MAJOR_VERSION <= 5
853 mFusionReslice->SetInput( mFusion->GetVTKImages()[mCurrentFusionTSlice]);
855 mFusionReslice->SetInputData( mFusion->GetVTKImages()[mCurrentFusionTSlice]);
858 // Update fusion transform
859 mConcatenatedFusionTransform->Identity();
860 mConcatenatedFusionTransform->Concatenate(mFusion->GetTransform()[mCurrentFusionTSlice]);
861 mConcatenatedFusionTransform->Concatenate(mSlicingTransform);
864 if (mSurfaceCutActors.size() > 0)
865 for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
866 i!=mSurfaceCutActors.end(); i++)
867 (*i)->SetTimeSlice(mCurrentTSlice);
868 UpdateDisplayExtent();
870 //------------------------------------------------------------------------------
873 //------------------------------------------------------------------------------
874 void vvSlicer::SetFusionSequenceTSlice(int t)
875 { //out << __func__ << endl;
876 if (mFusion && mFusionActor->GetVisibility() && (mFusionSequenceCode>=0)) {
877 if (mFusion->GetVTKImages().size() > (unsigned int)t) {
878 mCurrentFusionTSlice = t;
879 #if VTK_MAJOR_VERSION <= 5
880 mFusionReslice->SetInput( mFusion->GetVTKImages()[mCurrentFusionTSlice] );
882 mFusionReslice->SetInputData( mFusion->GetVTKImages()[mCurrentFusionTSlice] );
884 // Update fusion transform
885 mConcatenatedFusionTransform->Identity();
886 mConcatenatedFusionTransform->Concatenate(mFusion->GetTransform()[mCurrentFusionTSlice]); //not really useful...
887 mConcatenatedFusionTransform->Concatenate(mSlicingTransform);
891 UpdateDisplayExtent();
893 //------------------------------------------------------------------------------
896 //------------------------------------------------------------------------------
897 int vvSlicer::GetTSlice()
898 { //out << __func__ << endl;
899 return mCurrentTSlice;
901 //------------------------------------------------------------------------------
903 //------------------------------------------------------------------------------
904 int vvSlicer::GetMaxCurrentTSlice()
905 { //out << __func__ << endl;
906 int t = mCurrentTSlice;
908 t = std::max(t, mCurrentOverlayTSlice);
909 if(mFusion&& (mFusionSequenceCode<0)) //ignore fusionSequence data: for these, the times are not to be related (this way)
910 t = std::max(t, mCurrentFusionTSlice);
913 //------------------------------------------------------------------------------
915 //------------------------------------------------------------------------------
916 int vvSlicer::GetFusionTSlice()
917 { //out << __func__ << endl;
918 return mCurrentFusionTSlice;
920 //------------------------------------------------------------------------------
922 //------------------------------------------------------------------------------
923 int vvSlicer::GetOverlayTSlice()
924 { //out << __func__ << endl;
925 return mCurrentOverlayTSlice;
927 //------------------------------------------------------------------------------
929 //------------------------------------------------------------------------------
930 void vvSlicer::SetSliceOrientation(int orientation)
931 { //out << __func__ << endl;
932 //if 2D image, force to watch in Axial View
934 #if VTK_MAJOR_VERSION <= 5
935 this->GetInput()->GetWholeExtent(extent);
937 int* ext = mImageReslice->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());
938 copyExtent(ext, extent);
941 if (extent[5]-extent[4] <= 2)
942 orientation = vtkImageViewer2::SLICE_ORIENTATION_XY;
944 if (orientation < vtkImageViewer2::SLICE_ORIENTATION_YZ ||
945 orientation > vtkImageViewer2::SLICE_ORIENTATION_XY) {
946 vtkErrorMacro("Error - invalid slice orientation " << orientation);
950 this->SliceOrientation = orientation;
953 AdjustResliceToSliceOrientation(mFusionReslice);
956 AdjustResliceToSliceOrientation(mOverlayReslice);
960 // Go to current cursor position
961 // double* cursorPos = GetCursorPosition();
962 // DDV(cursorPos, 3);
963 // SetCurrentPosition(cursorPos[0],cursorPos[1],cursorPos[2],cursorPos[3]);
965 if (mFirstSetSliceOrientation) {
966 int *range = this->GetSliceRange();
968 this->Slice = static_cast<int>((range[0] + range[1]) * 0.5);
969 #if VTK_MAJOR_VERSION <= 5
970 mFirstSetSliceOrientation = false;
973 else if (this->Renderer && this->GetInput()) {
974 double s = mCursor[orientation];
975 double sCursor = (s - this->GetInput()->GetOrigin()[orientation])/this->GetInput()->GetSpacing()[orientation];
976 this->Slice = static_cast<int>(sCursor);
979 this->UpdateOrientation();
981 this->UpdateDisplayExtent();
983 if (mFirstSetSliceOrientation) {
984 mFirstSetSliceOrientation = false;
987 if (this->Renderer && this->GetInput()) {
988 double scale = this->Renderer->GetActiveCamera()->GetParallelScale();
989 this->Renderer->ResetCamera();
990 this->Renderer->GetActiveCamera()->SetParallelScale(scale);
995 //----------------------------------------------------------------------------
997 //------------------------------------------------------------------------------
998 // This function ensures that we sample the slices of a vtkImageReslice filter
999 // in the direction of the slicer (SliceOrientation) similarly as mImageReslice.
1000 // In other words, we change the grid of the reslice in the same way as the grid
1001 // of the displayed image in the slicing direction.
1002 void vvSlicer::AdjustResliceToSliceOrientation(vtkImageReslice *reslice)
1003 { //out << __func__ << endl;
1004 // Reset autocrop and update output information
1005 reslice->SetOutputOriginToDefault();
1006 reslice->SetOutputSpacingToDefault();
1007 #if VTK_MAJOR_VERSION <= 5
1008 reslice->GetOutput()->UpdateInformation();
1010 reslice->UpdateInformation();
1013 // Ge new origin / spacing
1016 reslice->GetOutput()->GetOrigin(origin);
1017 reslice->GetOutput()->GetSpacing(spacing);
1019 // Use similar spacing as the image in the direction SliceOrientation
1020 spacing[this->SliceOrientation] = mImageReslice->GetOutput()->GetSpacing()[this->SliceOrientation];
1022 // Modify origin to be on the image grid in the direction SliceOrientation in 3 steps
1023 // Step 1: from world coordinates to image coordinates
1024 origin[this->SliceOrientation] -= mImageReslice->GetOutput()->GetOrigin()[this->SliceOrientation];
1025 origin[this->SliceOrientation] /= mImageReslice->GetOutput()->GetSpacing()[this->SliceOrientation];
1027 // Step 2: round to nearest grid positionInc. This has been validated as the only
1028 // way to have something consistent with the thickness of a 2D slice visible on the
1029 // other slices. The thickness is accounted for so if the 2D slice is to thin and
1030 // between two slices, one will never be able to see this 2D slice (bug #1883).
1031 origin[this->SliceOrientation] = itk::Math::Round<double>(origin[this->SliceOrientation]);
1033 // Step 3: back to world coordinates
1034 origin[this->SliceOrientation] *= mImageReslice->GetOutput()->GetSpacing()[this->SliceOrientation];
1035 origin[this->SliceOrientation] += mImageReslice->GetOutput()->GetOrigin()[this->SliceOrientation];
1037 // Set new spacing and origin
1038 reslice->SetOutputOrigin(origin);
1039 reslice->SetOutputSpacing(spacing);
1040 reslice->UpdateInformation();
1042 //------------------------------------------------------------------------------
1044 //----------------------------------------------------------------------------
1045 int * vvSlicer::GetExtent()
1046 { //out << __func__ << endl;
1048 if (mUseReducedExtent) {
1049 w_ext = mReducedExtent;
1052 #if VTK_MAJOR_VERSION <= 5
1053 w_ext = GetInput()->GetWholeExtent();
1055 w_ext = mImageReslice->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());
1060 //----------------------------------------------------------------------------
1063 //----------------------------------------------------------------------------
1064 int vvSlicer::GetOrientation()
1065 { //out << __func__ << endl;
1066 return this->SliceOrientation;
1068 //----------------------------------------------------------------------------
1071 //----------------------------------------------------------------------------
1072 void vvSlicer::UpdateDisplayExtent()
1073 { //out << __func__ << endl;
1075 vtkImageData *input = this->GetInput();
1076 if (!input || !this->ImageActor) {
1080 #if VTK_MAJOR_VERSION <= 5
1081 input->UpdateInformation();
1084 mRegisterExtent = mImageReslice->GetOutputInformation(0)->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT());
1085 copyExtent(mRegisterExtent, extent);
1087 // Make sure that the required part image has been computed
1088 extent[SliceOrientation*2] = Slice;
1089 extent[SliceOrientation*2+1] = Slice;
1091 mImageReslice->SetUpdateExtent(extent);
1093 this->SetSlice( this->GetSlice() ); //SR: make sure the update let the slice in extents
1095 // Local copy of extent
1097 int* ext = GetExtent();
1098 copyExtent(ext, w_ext);
1102 w_ext[ this->SliceOrientation*2 ] = this->Slice;
1103 w_ext[ this->SliceOrientation*2+1 ] = this->Slice;
1106 this->ImageActor->SetVisibility(mImageVisibility);
1107 this->ImageActor->SetDisplayExtent(w_ext);
1108 #if VTK_MAJOR_VERSION >= 6
1109 vtkSmartPointer<vtkOpenGLImageSliceMapper> mapperOpenGL= vtkSmartPointer<vtkOpenGLImageSliceMapper>::New();
1111 mapperOpenGL = dynamic_cast<vtkOpenGLImageSliceMapper*>(GetImageActor()->GetMapper());
1112 } catch (const std::bad_cast& e) {
1113 std::cerr << e.what() << std::endl;
1114 std::cerr << "Conversion error" << std::endl;
1117 if (mFirstSetSliceOrientation) {
1118 copyExtent(ext, mRegisterExtent);
1120 int w_croppingRegion[6];
1121 if (mUseReducedExtent) {
1122 copyExtent(mReducedExtent, w_croppingRegion);
1124 copyExtent(mRegisterExtent, w_croppingRegion);
1126 w_croppingRegion[ this->SliceOrientation*2 ] = this->Slice;
1127 w_croppingRegion[ this->SliceOrientation*2+1 ] = this->Slice;
1128 mapperOpenGL->SetCroppingRegion(w_croppingRegion);
1132 #if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
1133 // Fix for bug #1882
1134 dynamic_cast<vtkImageSliceMapper *>(this->ImageActor->GetMapper())->SetOrientation(this->GetOrientation());
1137 // Overlay image actor
1138 if (mOverlay && mOverlayVisibility) {
1139 //mOverlayMapper->GetOutput()->Print(cout);
1140 AdjustResliceToSliceOrientation(mOverlayReslice);
1142 this->ConvertImageToImageDisplayExtent(input, w_ext, mOverlayReslice->GetOutput(), overExtent);
1143 #if VTK_MAJOR_VERSION <= 5
1144 bool out = ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetWholeExtent());
1146 bool out = ClipDisplayedExtent(overExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
1148 mOverlayActor->SetVisibility(!out);
1149 mOverlayActor->SetDisplayExtent( overExtent );
1150 #if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
1151 // Fix for bug #1882
1152 dynamic_cast<vtkImageSliceMapper *>(mOverlayActor->GetMapper())->SetOrientation(this->GetOrientation());
1156 mOverlayActor->SetVisibility(false);
1158 // Fusion image actor
1159 if (mFusion && mFusionVisibility) {
1160 AdjustResliceToSliceOrientation(mFusionReslice);
1162 this->ConvertImageToImageDisplayExtent(input, w_ext, mFusionReslice->GetOutput(), fusExtent);
1163 #if VTK_MAJOR_VERSION <= 5
1164 bool out = ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetWholeExtent());
1166 bool out = ClipDisplayedExtent(fusExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
1168 mFusionActor->SetVisibility(!out);
1169 mFusionActor->SetDisplayExtent( fusExtent );
1170 #if VTK_MAJOR_VERSION >= 6 || (VTK_MAJOR_VERSION >= 5 && VTK_MINOR_VERSION >= 10)
1171 // Fix for bug #1882
1172 dynamic_cast<vtkImageSliceMapper *>(mFusionActor->GetMapper())->SetOrientation(this->GetOrientation());
1176 mFusionActor->SetVisibility(false);
1177 // Vector field actor
1178 double* camera = Renderer->GetActiveCamera()->GetPosition();
1179 double* image_bounds = ImageActor->GetBounds();
1180 double position[3] = {0, 0, 0};
1181 position[this->SliceOrientation] = image_bounds[this->SliceOrientation*2];
1183 //print_vector<double, 6>("camera", camera);
1184 //print_vector<double, 6>("image_bounds", image_bounds);
1185 //print_vector<double, 3>("position", position);
1187 // find where to place the VF actor. to deal with
1188 // z-buffer issues, the VF is placed right in front of the image,
1189 // subject to a small offset. the position actually depends on the
1190 // the location of the camera relative to the image.
1192 if (camera[this->SliceOrientation] < image_bounds[this->SliceOrientation*2])
1195 if (mVF && mVFVisibility) {
1197 #if VTK_MAJOR_VERSION <= 5
1198 mVF->GetVTKImages()[0]->UpdateInformation();
1200 //this->UpdateInformation();
1202 this->ConvertImageToImageDisplayExtent(input, w_ext, mVF->GetVTKImages()[0], vfExtent);
1203 #if VTK_MAJOR_VERSION <= 5
1204 bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInput()->GetWholeExtent());
1206 bool out = ClipDisplayedExtent(vfExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
1208 mVFActor->SetVisibility(!out);
1209 mVOIFilter->SetVOI(vfExtent);
1210 int orientation[3] = {1,1,1};
1211 orientation[this->SliceOrientation] = 0;
1212 mGlyphFilter->SetOrientation(orientation[0], orientation[1], orientation[2]);
1213 position[this->SliceOrientation] += offset;
1214 mVFActor->SetPosition(position);
1215 mVFActor->GetProperty()->SetOpacity(0.995);
1216 mVFMapper->Update();
1220 mVFActor->SetVisibility(false);
1226 for(unsigned int i=0; i<6; i++)
1227 bounds[i] = ImageActor->GetBounds()[i];
1228 bounds[ this->SliceOrientation*2 ] = ImageActor->GetBounds()[ this->SliceOrientation*2 ]-fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
1229 bounds[ this->SliceOrientation*2+1 ] = ImageActor->GetBounds()[ this->SliceOrientation*2+1 ]+fabs(this->GetInput()->GetSpacing()[this->SliceOrientation]);
1230 mClipBox->SetBounds(bounds);
1234 position[this->SliceOrientation] = offset;
1235 mLandActor->SetPosition(position);
1238 // Figure out the correct clipping range
1239 if (this->Renderer) {
1240 if (this->InteractorStyle &&
1241 this->InteractorStyle->GetAutoAdjustCameraClippingRange()) {
1242 this->Renderer->ResetCameraClippingRange();
1244 vtkCamera *cam = this->Renderer->GetActiveCamera();
1247 this->ImageActor->GetBounds(bounds);
1248 double spos = (double)bounds[this->SliceOrientation * 2];
1249 double cpos = (double)cam->GetPosition()[this->SliceOrientation];
1250 double range = fabs(spos - cpos);
1251 double *spacing = input->GetSpacing();
1252 double sumSpacing = spacing[0] + spacing[1] + spacing[2];
1253 cam->SetClippingRange(range - sumSpacing, range + sumSpacing);
1258 //----------------------------------------------------------------------------
1260 //----------------------------------------------------------------------------
1261 void vvSlicer::ConvertImageToImageDisplayExtent(vtkImageData *sourceImage, const int sourceExtent[6],
1262 vtkImageData *targetImage, int targetExtent[6])
1263 { //out << __func__ << endl;
1265 for(unsigned int i=0; i<6; i++) {
1266 // From source voxel coordinates to world coordinates
1267 dExtents[i] = sourceImage->GetOrigin()[i/2] + sourceImage->GetSpacing()[i/2] * sourceExtent[i];
1269 // From world coordinates to floating point target voxel coordinates
1270 dExtents[i] = (dExtents[i]- targetImage->GetOrigin()[i/2]) / targetImage->GetSpacing()[i/2];
1272 // Round to current slice or larger extent
1273 if(i/2==this->GetOrientation())
1274 targetExtent[i] = itk::Math::Round<double>(dExtents[i]);
1276 targetExtent[i] = itk::Math::Ceil<double>(dExtents[i]);
1278 targetExtent[i] = itk::Math::Floor<double>(dExtents[i]);
1281 //----------------------------------------------------------------------------
1283 //----------------------------------------------------------------------------
1284 bool vvSlicer::ClipDisplayedExtent(int extent[6], int refExtent[6])
1285 { //out << __func__ << endl;
1289 for (int i = 0; i < maxBound; i = i+2) {
1290 //if we are totally outside the image
1291 if ( extent[i] > refExtent[i+1] || extent[i+1] < refExtent[i] ) {
1295 //crop to the limit of the image
1296 extent[i] = std::max(extent[i], refExtent[i]);
1297 extent[i] = std::min(extent[i], refExtent[i+1]);;
1298 extent[i+1] = std::max(extent[i+1], refExtent[i]);
1299 extent[i+1] = std::min(extent[i+1], refExtent[i+1]);;
1302 for (int i = 0; i < maxBound; i = i+2) {
1303 extent[i] = refExtent[i];
1304 extent[i+1] = refExtent[i];
1308 //----------------------------------------------------------------------------
1311 //----------------------------------------------------------------------------
1312 void vvSlicer::UpdateOrientation()
1313 { //out << __func__ << endl;
1314 // Set the camera position
1315 vtkCamera *cam = this->Renderer ? this->Renderer->GetActiveCamera() : NULL;
1317 switch (this->SliceOrientation) {
1318 case vtkImageViewer2::SLICE_ORIENTATION_XY:
1319 cam->SetFocalPoint(0,0,0);
1320 cam->SetPosition(0,0,-1); // -1 if medical ?
1321 cam->SetViewUp(0,-1,0);
1324 case vtkImageViewer2::SLICE_ORIENTATION_XZ:
1325 cam->SetFocalPoint(0,0,0);
1326 cam->SetPosition(0,-1,0); // 1 if medical ?
1327 cam->SetViewUp(0,0,1);
1330 case vtkImageViewer2::SLICE_ORIENTATION_YZ:
1331 cam->SetFocalPoint(0,0,0);
1332 cam->SetPosition(-1,0,0); // -1 if medical ?
1333 cam->SetViewUp(0,0,1);
1338 //----------------------------------------------------------------------------
1341 //----------------------------------------------------------------------------
1342 void vvSlicer::SetOpacity(double s)
1343 { //out << __func__ << endl;
1344 this->GetImageActor()->SetOpacity(s);
1346 //----------------------------------------------------------------------------
1349 //----------------------------------------------------------------------------
1350 void vvSlicer::SetRenderWindow(int orientation, vtkRenderWindow * rw)
1351 { //out << __func__ << endl;
1352 this->Superclass::SetRenderWindow(rw);
1353 this->SetupInteractor(rw->GetInteractor());
1354 ca->SetImageActor(this->GetImageActor());
1355 ca->SetWindowLevel(this->GetWindowLevel());
1356 ca->SetText(3, "<window>\n<level>");
1367 crossCursor->SetModelBounds(bounds);
1369 this->GetRenderer()->AddActor(pdmA);
1370 this->GetRenderer()->AddActor(ca);
1371 this->GetRenderer()->ResetCamera();
1373 //this is just a mapping between the labeling of the orientations presented to the user and
1374 //the one used by vtk
1375 SetSliceOrientation(2-(orientation%3));
1378 //----------------------------------------------------------------------------
1381 //----------------------------------------------------------------------------
1382 void vvSlicer::ResetCamera()
1383 { //out << __func__ << endl;
1384 this->GetRenderer()->ResetCamera();
1386 //----------------------------------------------------------------------------
1389 //----------------------------------------------------------------------------
1390 void vvSlicer::SetDisplayMode(bool i)
1391 { //out << __func__ << endl;
1392 this->GetRenderer()->SetDraw(i);
1393 if (i) UpdateDisplayExtent();
1395 //----------------------------------------------------------------------------
1398 //----------------------------------------------------------------------------
1399 void vvSlicer::FlipHorizontalView()
1400 { //out << __func__ << endl;
1401 vtkCamera *cam = this->Renderer ? this->Renderer->GetActiveCamera() : NULL;
1403 double *position = cam->GetPosition();
1404 double factor[3] = {1, 1, 1};
1405 factor[this->SliceOrientation] = -1;
1406 cam->SetPosition(factor[0]*position[0],factor[1]*position[1],factor[2]*position[2]);
1408 /* switch (this->SliceOrientation) {
1409 case vtkImageViewer2::SLICE_ORIENTATION_XY:
1410 cam->SetPosition(position[0],position[1],-position[2]);
1413 case vtkImageViewer2::SLICE_ORIENTATION_XZ:
1414 cam->SetPosition(position[0],-position[1],position[2]);
1417 case vtkImageViewer2::SLICE_ORIENTATION_YZ:
1418 cam->SetPosition(-position[0],position[1],position[2]);
1422 this->Renderer->ResetCameraClippingRange();
1423 this->UpdateDisplayExtent();
1426 //----------------------------------------------------------------------------
1429 //----------------------------------------------------------------------------
1430 void vvSlicer::FlipVerticalView()
1431 { //out << __func__ << endl;
1432 vtkCamera *cam = this->Renderer ? this->Renderer->GetActiveCamera() : NULL;
1434 FlipHorizontalView();
1435 double *viewup = cam->GetViewUp();
1436 cam->SetViewUp(-viewup[0],-viewup[1],-viewup[2]);
1437 this->UpdateDisplayExtent();
1440 //----------------------------------------------------------------------------
1443 //----------------------------------------------------------------------------
1444 void vvSlicer::SetColorWindow(double window)
1445 { //out << __func__ << endl;
1446 vtkLookupTable* LUT = static_cast<vtkLookupTable*>(this->GetWindowLevel()->GetLookupTable());
1448 double level = this->GetWindowLevel()->GetLevel();
1449 LUT->SetTableRange(level-fabs(window)/2,level+fabs(window)/2);
1452 this->vtkImageViewer2::SetColorWindow(window);
1454 //----------------------------------------------------------------------------
1456 //----------------------------------------------------------------------------
1457 void vvSlicer::SetColorLevel(double level)
1458 { //out << __func__ << endl;
1459 vtkLookupTable* LUT = static_cast<vtkLookupTable*>(this->GetWindowLevel()->GetLookupTable());
1461 double window = this->GetWindowLevel()->GetWindow();
1462 LUT->SetTableRange(level-fabs(window)/2,level+fabs(window)/2);
1465 this->vtkImageViewer2::SetColorLevel(level);
1467 //----------------------------------------------------------------------------
1469 //----------------------------------------------------------------------------
1470 double vvSlicer::GetOverlayColorWindow()
1471 { //out << __func__ << endl;
1473 return mOverlayMapper->GetWindow();
1477 //----------------------------------------------------------------------------
1479 //----------------------------------------------------------------------------
1480 double vvSlicer::GetOverlayColorLevel()
1481 { //out << __func__ << endl;
1483 return mOverlayMapper->GetLevel();
1487 //----------------------------------------------------------------------------
1489 //----------------------------------------------------------------------------
1490 void vvSlicer::SetOverlayColorWindow(double window)
1491 { //out << __func__ << endl;
1493 mOverlayMapper->SetWindow(window);
1495 //----------------------------------------------------------------------------
1497 //----------------------------------------------------------------------------
1498 void vvSlicer::SetOverlayColorLevel(double level)
1499 { //out << __func__ << endl;
1501 mOverlayMapper->SetLevel(level);
1503 //----------------------------------------------------------------------------
1505 //----------------------------------------------------------------------------
1506 // Returns the min an the max value in a 20%x20% region around the mouse pointer
1507 void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max, vtkImageData *image, vtkTransform *transform)
1508 { //out << __func__ << endl;
1509 //Get mouse pointer position in view coordinates
1512 for(int i=0; i<3; i++) {
1513 corner1[i] = mCurrent[i];
1514 corner2[i] = mCurrent[i];
1517 this->Renderer->WorldToView(corner1[0], corner1[1], corner1[2]);
1518 this->Renderer->WorldToView(corner2[0], corner2[1], corner2[2]);
1520 // In view coordinates, x is the slicer width and y is the slicer height are the in-plane axis
1522 this->Renderer->GetTiledSize(&w, &h);
1523 corner1[0] -= 0.2*h/(double)w;
1524 corner2[0] += 0.2*h/(double)w;
1527 this->Renderer->ViewToWorld(corner1[0], corner1[1], corner1[2]);
1528 this->Renderer->ViewToWorld(corner2[0], corner2[1], corner2[2]);
1530 //Convert to image pixel coordinates (rounded)
1531 transform->TransformPoint(corner1, corner1);
1532 transform->TransformPoint(corner2, corner2);
1533 int iLocalExtents[6];
1534 for(int i=0; i<3; i++) {
1535 corner1[i] = (corner1[i] - image->GetOrigin()[i])/image->GetSpacing()[i];
1536 corner2[i] = (corner2[i] - image->GetOrigin()[i])/image->GetSpacing()[i];
1538 iLocalExtents[i*2 ] = lrint(corner1[i]);
1539 iLocalExtents[i*2+1] = lrint(corner2[i]);
1541 if(iLocalExtents[i*2 ]>iLocalExtents[i*2+1])
1542 std::swap(iLocalExtents[i*2], iLocalExtents[i*2+1]);
1545 vtkSmartPointer<vtkExtractVOI> voiFilter = vtkSmartPointer<vtkExtractVOI>::New();
1546 #if VTK_MAJOR_VERSION <= 5
1547 voiFilter->SetInput(image);
1549 voiFilter->SetInputData(image);
1551 voiFilter->SetVOI(iLocalExtents);
1552 voiFilter->Update();
1553 if (!voiFilter->GetOutput()->GetNumberOfPoints()) {
1559 vtkSmartPointer<vtkImageAccumulate> accFilter = vtkSmartPointer<vtkImageAccumulate>::New();
1560 #if VTK_MAJOR_VERSION <= 5
1561 accFilter->SetInput(voiFilter->GetOutput());
1563 accFilter->SetInputConnection(voiFilter->GetOutputPort(0));
1565 accFilter->Update();
1567 min = *(accFilter->GetMin());
1568 max = *(accFilter->GetMax());
1570 //----------------------------------------------------------------------------
1572 //----------------------------------------------------------------------------
1573 double vvSlicer::GetScalarComponentAsDouble(vtkImageData *image, double X, double Y, double Z, int &ix, int &iy, int &iz, int component)
1574 { //out << __func__ << endl;
1578 #if VTK_MAJOR_VERSION <= 5
1579 if (ix < image->GetWholeExtent()[0] ||
1580 ix > image->GetWholeExtent()[1] ||
1581 iy < image->GetWholeExtent()[2] ||
1582 iy > image->GetWholeExtent()[3] ||
1583 iz < image->GetWholeExtent()[4] ||
1584 iz > image->GetWholeExtent()[5] )
1585 return std::numeric_limits<double>::quiet_NaN();
1586 image->SetUpdateExtent(ix, ix, iy, iy, iz, iz);
1589 if (ix < image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[0] ||
1590 ix > image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[1] ||
1591 iy < image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[2] ||
1592 iy > image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[3] ||
1593 iz < image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[4] ||
1594 iz > image->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[5] )
1595 return std::numeric_limits<double>::quiet_NaN();
1596 //image->SetUpdateExtent(ix, ix, iy, iy, iz, iz);
1600 return image->GetScalarComponentAsDouble(ix, iy, iz, component);
1602 //----------------------------------------------------------------------------
1604 //----------------------------------------------------------------------------
1605 void vvSlicer::Render()
1606 { //out << __func__ << endl;
1607 if (this->mFusion && mFusionActor->GetVisibility() && showFusionLegend) {
1608 legend->SetLookupTable(this->GetFusionMapper()->GetLookupTable());
1609 legend->UseOpacityOn();
1610 legend->SetVisibility(1);
1612 else if (this->GetWindowLevel()->GetLookupTable() && !this->mOverlay) {
1613 legend->SetLookupTable(this->GetWindowLevel()->GetLookupTable());
1614 legend->UseOpacityOff();
1615 legend->SetVisibility(1);
1616 } else legend->SetVisibility(0);
1618 if (ca->GetVisibility()) {
1620 std::stringstream worldPos(" ");
1622 mConcatenatedTransform->TransformPoint(mCurrent, pt);
1623 double X = (pt[0] - mImage->GetVTKImages()[mCurrentTSlice]->GetOrigin()[0])/mImage->GetVTKImages()[mCurrentTSlice]->GetSpacing()[0];
1624 double Y = (pt[1] - mImage->GetVTKImages()[mCurrentTSlice]->GetOrigin()[1])/mImage->GetVTKImages()[mCurrentTSlice]->GetSpacing()[1];
1625 double Z = (pt[2] - mImage->GetVTKImages()[mCurrentTSlice]->GetOrigin()[2])/mImage->GetVTKImages()[mCurrentTSlice]->GetSpacing()[2];
1626 #if VTK_MAJOR_VERSION <= 5
1627 if (X >= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[0]-0.5 &&
1628 X <= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[1]+0.5 &&
1629 Y >= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[2]-0.5 &&
1630 Y <= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[3]+0.5 &&
1631 Z >= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[4]-0.5 &&
1632 Z <= mImage->GetVTKImages()[mCurrentTSlice]->GetWholeExtent()[5]+0.5) {
1636 double value = this->GetScalarComponentAsDouble(mImage->GetVTKImages()[mCurrentTSlice], X, Y, Z, ix, iy, iz);
1638 if(ImageActor->GetVisibility())
1639 worldPos << "data value : " << value << std::endl;
1641 worldPos << "mm : " << lrint(mCurrentBeforeSlicingTransform[0]) << ' '
1642 << lrint(mCurrentBeforeSlicingTransform[1]) << ' '
1643 << lrint(mCurrentBeforeSlicingTransform[2]) << ' '
1646 worldPos << "pixel : " << ix << ' '
1653 if (X >= mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[0]-0.5 &&
1654 X <= mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[1]+0.5 &&
1655 Y >= mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[2]-0.5 &&
1656 Y <= mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[3]+0.5 &&
1657 Z >= mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[4]-0.5 &&
1658 Z <= mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[5]+0.5) {
1661 double value = this->GetScalarComponentAsDouble(mImage->GetVTKImages()[mCurrentTSlice], X, Y, Z, ix, iy, iz);
1663 if(ImageActor->GetVisibility())
1664 worldPos << "data value : " << value << std::endl;
1666 worldPos << "mm : " << lrint(mCurrentBeforeSlicingTransform[0]) << ' '
1667 << lrint(mCurrentBeforeSlicingTransform[1]) << ' '
1668 << lrint(mCurrentBeforeSlicingTransform[2]) << ' '
1671 worldPos << "pixel : " << ix << ' '
1679 ca->SetText(1,worldPos.str().c_str());
1681 std::stringstream slicePos;
1682 slicePos << "Slice: " << this->GetSlice();
1683 ca->SetText(2, slicePos.str().c_str());
1686 if (pdmA->GetVisibility()) {
1687 double x = mCursor[0];
1688 double y = mCursor[1];
1689 double z = mCursor[2];
1690 double xCursor = (x - this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
1691 double yCursor = (y - this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
1692 double zCursor = (z - this->GetInput()->GetOrigin()[2])/this->GetInput()->GetSpacing()[2];
1693 #if VTK_MAJOR_VERSION <= 5
1694 if (xCursor >= this->GetImageActor()->GetDisplayExtent()[0]-0.5 &&
1695 xCursor < this->GetImageActor()->GetDisplayExtent()[1]+0.5 &&
1696 yCursor >= this->GetImageActor()->GetDisplayExtent()[2]-0.5 &&
1697 yCursor < this->GetImageActor()->GetDisplayExtent()[3]+0.5 &&
1698 zCursor >= this->GetImageActor()->GetDisplayExtent()[4]-0.5 &&
1699 zCursor < this->GetImageActor()->GetDisplayExtent()[5]+0.5 ) {
1700 vtkRenderer * renderer = this->Renderer;
1702 renderer->WorldToView(x,y,z);
1703 renderer->ViewToNormalizedViewport(x,y,z);
1704 renderer->NormalizedViewportToViewport(x,y);
1705 renderer->ViewportToNormalizedDisplay(x,y);
1706 renderer->NormalizedDisplayToDisplay(x,y);
1707 crossCursor->SetFocalPoint(x,y,z);
1709 crossCursor->SetFocalPoint(-1,-1,z);
1710 crossCursor->Update();
1713 vtkSmartPointer<vtkOpenGLImageSliceMapper> mapperOpenGL= vtkSmartPointer<vtkOpenGLImageSliceMapper>::New();
1715 mapperOpenGL = dynamic_cast<vtkOpenGLImageSliceMapper*>(GetImageActor()->GetMapper());
1716 } catch (const std::bad_cast& e) {
1717 std::cerr << e.what() << std::endl;
1718 std::cerr << "Conversion error" << std::endl;
1722 if (xCursor >= mapperOpenGL->GetCroppingRegion()[0]-0.5 &&
1723 xCursor < mapperOpenGL->GetCroppingRegion()[1]+0.5 &&
1724 yCursor >= mapperOpenGL->GetCroppingRegion()[2]-0.5 &&
1725 yCursor < mapperOpenGL->GetCroppingRegion()[3]+0.5 &&
1726 zCursor >= mapperOpenGL->GetCroppingRegion()[4]-0.5 &&
1727 zCursor < mapperOpenGL->GetCroppingRegion()[5]+0.5 ) {
1728 vtkRenderer * renderer = this->Renderer;
1730 renderer->WorldToView(x,y,z);
1731 renderer->ViewToNormalizedViewport(x,y,z);
1732 renderer->NormalizedViewportToViewport(x,y);
1733 renderer->ViewportToNormalizedDisplay(x,y);
1734 renderer->NormalizedDisplayToDisplay(x,y);
1735 crossCursor->SetFocalPoint(x,y,z);
1737 crossCursor->SetFocalPoint(-1,-1,z);
1738 crossCursor->Update();
1742 if (mOverlay && mOverlayActor->GetVisibility()) {
1743 if(mLinkOverlayWindowLevel) {
1744 mOverlayMapper->SetWindow(this->GetColorWindow());
1745 mOverlayMapper->SetLevel(this->GetColorLevel());
1747 #if VTK_MAJOR_VERSION <= 5
1748 mOverlayMapper->GetOutput()->SetUpdateExtent(mOverlayActor->GetDisplayExtent());
1750 mOverlayMapper->SetUpdateExtent(mOverlayActor->GetDisplayExtent());
1752 mOverlayMapper->Update();
1754 if (mFusion && mFusionActor->GetVisibility()) {
1755 #if VTK_MAJOR_VERSION <= 5
1756 mFusionMapper->GetOutput()->SetUpdateExtent(mFusionActor->GetDisplayExtent());
1758 mFusionMapper->SetUpdateExtent(mFusionActor->GetDisplayExtent());
1760 mFusionMapper->Update();
1765 this->GetRenderWindow()->Render();
1767 //----------------------------------------------------------------------------
1770 //----------------------------------------------------------------------------
1771 void vvSlicer::UpdateCursorPosition()
1772 { //out << __func__ << endl;
1773 pdmA->SetVisibility(true);
1774 mCursor[0] = mCurrent[0];
1775 mCursor[1] = mCurrent[1];
1776 mCursor[2] = mCurrent[2];
1777 mCursor[3] = mCurrentTSlice;
1779 //----------------------------------------------------------------------------
1782 //----------------------------------------------------------------------------
1783 void vvSlicer::UpdateLandmarks()
1784 { //out << __func__ << endl;
1785 vtkPolyData *pd = static_cast<vtkPolyData*>(mLandClipper->GetInput());
1786 if (pd->GetPoints()) {
1787 //mLandGlyph->SetRange(0,1);
1788 //mLandGlyph->Modified();
1789 //mLandGlyph->Update();
1791 mClipBox->Modified();
1792 mLandClipper->Update();
1793 mLandMapper->Update();
1794 //Let's add the captions
1795 //First remove all captions:
1796 for(unsigned int i=0;i<mLandLabelActors.size();i++) {
1797 this->Renderer->RemoveActor2D(mLandLabelActors[i]);
1798 //allActors2D->Remove (mLandLabelActors[i]);
1800 mLandLabelActors.clear();
1801 //Next add the captions to the displayed points
1802 for (vtkIdType id=0; id<mLandClipper->GetOutput()->GetNumberOfPoints(); id++) {
1803 double *position = mLandClipper->GetOutput()->GetPoint(id);
1804 vtkStdString label = static_cast<vtkStringArray*>(mLandClipper->GetOutput()->GetPointData()->GetAbstractArray("labels"))->GetValue(id);
1805 vtkSmartPointer<vtkCaptionActor2D> label_actor = vtkSmartPointer<vtkCaptionActor2D>::New();
1806 label_actor->SetCaption(label);
1807 label_actor->SetAttachmentPoint(position);
1808 label_actor->GetCaptionTextProperty()->SetColor(1,0,0);
1809 label_actor->GetCaptionTextProperty()->SetOrientation(33.333333);
1810 label_actor->GetCaptionTextProperty()->SetFontFamilyToTimes();
1811 label_actor->GetCaptionTextProperty()->SetBold(0);
1812 label_actor->GetCaptionTextProperty()->SetFontSize(6);
1813 label_actor->BorderOff();
1814 label_actor->LeaderOff();
1815 label_actor->ThreeDimensionalLeaderOff();
1816 mLandLabelActors.push_back(label_actor);
1817 this->Renderer->AddActor2D(mLandLabelActors[id]);
1822 //----------------------------------------------------------------------------
1825 //----------------------------------------------------------------------------
1826 void vvSlicer::SetSlice(int slice)
1827 { //out << __func__ << endl;
1828 int *range = this->GetSliceRange();
1830 if (slice < range[0]) {
1832 } else if (slice > range[1]) {
1837 if (this->Slice == slice) {
1841 this->Slice = slice;
1844 this->UpdateDisplayExtent();
1846 // Seems to work without this line
1849 //----------------------------------------------------------------------------
1851 //----------------------------------------------------------------------------
1852 int vvSlicer::GetTMax()
1853 { //out << __func__ << endl;
1854 int tmax = (int)mImage->GetVTKImages().size() - 1;
1856 tmax = std::max(tmax, (int)mOverlay->GetVTKImages().size()-1);
1859 //----------------------------------------------------------------------------
1861 //----------------------------------------------------------------------------
1862 void vvSlicer::SetContourSlice()
1863 { //out << __func__ << endl;
1864 if (mSurfaceCutActors.size() > 0)
1865 for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
1866 i!=mSurfaceCutActors.end(); i++) {
1868 (*i)->SetSlicingOrientation(this->SliceOrientation);
1869 (*i)->SetCutSlice((this->Slice)*this->GetImage()->GetSpacing()[this->SliceOrientation]+
1870 this->GetImage()->GetOrigin()[this->SliceOrientation]);
1873 //----------------------------------------------------------------------------
1876 //----------------------------------------------------------------------------
1877 void vvSlicer::ForceUpdateDisplayExtent()
1878 { //out << __func__ << endl;
1879 this->UpdateDisplayExtent();
1881 //----------------------------------------------------------------------------
1884 //----------------------------------------------------------------------------
1885 int* vvSlicer::GetDisplayExtent()
1886 { //out << __func__ << endl;
1887 return this->GetImageActor()->GetDisplayExtent();
1889 //----------------------------------------------------------------------------
1892 //----------------------------------------------------------------------------
1893 void vvSlicer::PrintSelf(ostream& os, vtkIndent indent)
1894 { //out << __func__ << endl;
1895 this->Superclass::PrintSelf(os, indent);
1897 //----------------------------------------------------------------------------
1900 //----------------------------------------------------------------------------
1901 void vvSlicer::SetVFColor(double r, double g, double b)
1902 { //out << __func__ << endl;
1903 double mVFColorHSV[3];
1908 vtkMath::RGBToHSV(mVFColor, mVFColorHSV);
1909 mVFColorLUT->SetHueRange(mVFColorHSV[0], mVFColorHSV[0]);
1910 mVFColorLUT->SetSaturationRange(mVFColorHSV[1],mVFColorHSV[1]);
1911 mVFColorLUT->SetValueRange(mVFColorHSV[2], mVFColorHSV[2]);
1915 //----------------------------------------------------------------------------
1918 //----------------------------------------------------------------------------
1919 void vvSlicer::SetRegisterExtent(int ext[6])
1920 { //out << __func__ << endl;
1921 copyExtent(ext, mRegisterExtent);
1923 //----------------------------------------------------------------------------
1926 //----------------------------------------------------------------------------
1927 void vvSlicer::GetRegisterExtent(int ext[6])
1928 { //out << __func__ << endl;
1929 copyExtent(mRegisterExtent, ext);
1931 //----------------------------------------------------------------------------