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://oncora1.lyon.fnclcc.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 "vvSlicerManager.h"
22 #include "vvSlicerManagerCommand.h"
23 #include "vvInteractorStyleNavigator.h"
24 #include "vvLandmarks.h"
26 #include "vvImageMapToWLColors.h"
27 #include "vvBlendImageActor.h"
29 #include <vtkImageActor.h>
30 #include <vtkImageData.h>
31 #include <vtkRenderWindow.h>
32 #include <vtkRendererCollection.h>
33 #include <vtkRenderWindowInteractor.h>
34 #include <vtkImageMapToWindowLevelColors.h>
35 #include <vtkWindowLevelLookupTable.h>
36 #include <vtkColorTransferFunction.h>
37 #include <vtkImageClip.h>
38 #include <vtkLODActor.h>
39 #include <vtkPointData.h>
40 #include <vtksys/SystemTools.hxx>
41 #include <vtkCamera.h>
43 #include <qfileinfo.h>
45 //----------------------------------------------------------------------------
46 vvSlicerManager::vvSlicerManager(int numberOfSlicers)
55 mType = vvImageReader::UNDEFINEDIMAGETYPE;
61 mFusionThresOpacity = 1;
65 mFusionShowLegend = true;
70 for ( int i = 0; i < numberOfSlicers; i++)
71 mSlicers.push_back(vtkSmartPointer<vvSlicer>::New());
73 mPreviousSlice.resize(numberOfSlicers);
74 mPreviousTSlice.resize(numberOfSlicers);
76 //----------------------------------------------------------------------------
79 //----------------------------------------------------------------------------
80 vvSlicerManager::~vvSlicerManager()
85 //----------------------------------------------------------------------------
88 //------------------------------------------------------------------------------
89 void vvSlicerManager::SetFilename(std::string filename, int number)
92 mFileName = vtksys::SystemTools::GetFilenameName(mFileName);
93 mBaseFileName = vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(mFileName));
94 mBaseFileNameNumber = number;
96 mFileName = mBaseFileName;
98 mFileName.append("_"+clitk::toString(number));
100 mFileName.append(vtksys::SystemTools::GetFilenameLastExtension(filename));
102 for(unsigned int i=0; i<mSlicers.size(); i++) {
103 mSlicers[i]->SetFileName(mFileName);//vtksys::SystemTools::GetFilenameWithoutLastExtension(filename));
107 //------------------------------------------------------------------------------
110 //----------------------------------------------------------------------------
111 void vvSlicerManager::AddContour(vvMesh::Pointer contour,bool propagate)
113 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
114 mSlicers[i]->AddContour(contour,propagate);
117 //----------------------------------------------------------------------------
120 //----------------------------------------------------------------------------
121 void vvSlicerManager::ToggleContourSuperposition()
123 for ( unsigned int i = 0; i < mSlicers.size(); i++)
124 mSlicers[i]->ToggleContourSuperposition();
126 //----------------------------------------------------------------------------
128 //----------------------------------------------------------------------------
129 std::string vvSlicerManager::GetListOfAbsoluteFilePathInOneString(const std::string &actorType)
131 vvImageReader *reader = NULL;
133 if(actorType=="image")
135 else if(actorType=="overlay")
136 reader = mOverlayReader;
137 else if(actorType=="fusion")
138 reader = mFusionReader;
139 else if(actorType=="vector")
140 reader = mVectorReader;
146 for(unsigned int i=0; i<reader->GetInputFilenames().size(); i++){
147 QFileInfo fileinfo(reader->GetInputFilenames()[i].c_str()); //Do not show the path
150 list += fileinfo.absoluteFilePath().toStdString();
154 //----------------------------------------------------------------------------
157 //----------------------------------------------------------------------------
158 bool vvSlicerManager::SetImage(std::string filename, vvImageReader::LoadedImageType type, int n, unsigned int slice)
161 if (mReader.IsNull())
162 mReader = vvImageReader::New();
163 std::vector<std::string> filenames;
164 filenames.push_back(filename);
165 mReader->SetInputFilenames(filenames);
166 mReader->SetSlice(slice); // Only used for SLICED type
167 mReader->Update(type);
169 SetFilename(filename, n);
170 // mFileName = vtksys::SystemTools::GetFilenameName(mFileName);
171 //mBaseFileName = vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(mFileName));
172 //mBaseFileNameNumber = n;
174 if (mReader->GetLastError().size() == 0) {
175 mImage=mReader->GetOutput();
176 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
177 mSlicers[i]->SetFileName(vtksys::SystemTools::GetFilenameWithoutLastExtension(filename));
178 mSlicers[i]->SetImage(mReader->GetOutput());
181 mLastError = mReader->GetLastError();
185 // mFileName.append("_"+clitk::toString(n));
189 //----------------------------------------------------------------------------
192 //----------------------------------------------------------------------------
193 void vvSlicerManager::SetImage(vvImage::Pointer image)
196 for (unsigned int i = 0; i < mSlicers.size(); i++) {
197 mSlicers[i]->SetImage(image);
200 //----------------------------------------------------------------------------
203 //----------------------------------------------------------------------------
204 bool vvSlicerManager::SetImages(std::vector<std::string> filenames, vvImageReader::LoadedImageType type, int n)
207 std::string fileWithoutExtension = vtksys::SystemTools::GetFilenameWithoutExtension(filenames[0]);
208 if (type == vvImageReader::DICOM)
209 fileWithoutExtension += "_dicom";
210 else if (type == vvImageReader::MERGED)
211 fileWithoutExtension += "_merged";
212 else if (type == vvImageReader::MERGEDWITHTIME)
213 fileWithoutExtension += "_merged_wt";
215 mFileName = vtksys::SystemTools::GetFilenameName(mFileName);
216 mFileName = fileWithoutExtension + vtksys::SystemTools::GetFilenameExtension(filenames[0]);
217 if (mReader.IsNull())
218 mReader = vvImageReader::New();
219 mReader->SetInputFilenames(filenames);
220 mReader->Update(type);
222 mBaseFileName = vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(mFileName));
223 mBaseFileNameNumber = n;
225 if (mReader->GetLastError().size() == 0) {
226 mImage=mReader->GetOutput();
227 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
228 mSlicers[i]->SetFileName(fileWithoutExtension);
229 mSlicers[i]->SetImage(mReader->GetOutput());
232 mLastError = mReader->GetLastError();
236 mFileName.append("_"+clitk::toString(n));
240 //----------------------------------------------------------------------------
243 //----------------------------------------------------------------------------
244 bool vvSlicerManager::SetOverlay(std::string filename,int dim, std::string component)
246 mOverlayName = filename;
247 mOverlayComponent = component;
248 if (dim > mImage->GetNumberOfDimensions()) {
249 mLastError = " Overlay dimension cannot be greater then reference image!";
252 if (mOverlayReader.IsNull())
253 mOverlayReader = vvImageReader::New();
254 std::vector<std::string> filenames;
255 filenames.push_back(filename);
256 mOverlayReader->SetInputFilenames(filenames);
257 mOverlayReader->Update(mImage->GetNumberOfDimensions(),component.c_str(),mType);
258 if (mOverlayReader->GetLastError().size() == 0) {
259 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
260 mSlicers[i]->SetOverlay(mOverlayReader->GetOutput());
263 mLastError = mOverlayReader->GetLastError();
268 //----------------------------------------------------------------------------
271 //----------------------------------------------------------------------------
272 bool vvSlicerManager::SetFusion(std::string filename,int dim, std::string component)
274 mFusionName = filename;
275 mFusionComponent = component;
276 if (dim > mImage->GetNumberOfDimensions()) {
277 mLastError = " Overlay dimension cannot be greater then reference image!";
280 if (mFusionReader.IsNull())
281 mFusionReader = vvImageReader::New();
282 std::vector<std::string> filenames;
283 filenames.push_back(filename);
284 mFusionReader->SetInputFilenames(filenames);
285 mFusionReader->Update(mImage->GetNumberOfDimensions(),component.c_str(),mType);
286 if (mFusionReader->GetLastError().size() == 0) {
287 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
288 mSlicers[i]->SetFusion(mFusionReader->GetOutput());
291 mLastError = mFusionReader->GetLastError();
294 double *fusRange = mFusionReader->GetOutput()->GetVTKImages()[0]->GetScalarRange();
295 mFusionLevel = (fusRange[0]+fusRange[1])/2;
296 mFusionWindow = fusRange[1]-fusRange[0];
300 //----------------------------------------------------------------------------
303 //----------------------------------------------------------------------------
304 bool vvSlicerManager::SetVF(std::string filename)
306 if (mVectorReader.IsNull())
307 mVectorReader = vvImageReader::New();
308 mVectorReader->SetInputFilename(filename);
310 if (mType == vvImageReader::IMAGEWITHTIME)
311 mVectorReader->Update(vvImageReader::VECTORFIELDWITHTIME);
313 mVectorReader->Update(vvImageReader::VECTORFIELD);
314 if (mVectorReader->GetLastError().size() != 0) {
315 mLastError = mVectorReader->GetLastError();
318 return SetVF(mVectorReader->GetOutput(),filename);
320 //----------------------------------------------------------------------------
323 //----------------------------------------------------------------------------
324 bool vvSlicerManager::SetVF(vvImage::Pointer vf,std::string filename)
326 if (vf->GetNumberOfDimensions() > mImage->GetNumberOfDimensions()) {
327 mLastError = "Sorry, vector field dimension cannot be greater then reference image.";
330 if (vf->GetNumberOfDimensions() == 4) {
331 if (vf->GetSpacing()[3] != mImage->GetSpacing()[3]) {
332 mLastError = "Sorry, vector field time spacing cannot be different from time spacing of the reference image.";
335 if (vf->GetOrigin()[3] != mImage->GetOrigin()[3]) {
336 mLastError = "Sorry, vector field time origin cannot be different from time origin of the reference image.";
342 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
343 mSlicers[i]->SetVF(vf);
347 //----------------------------------------------------------------------------
350 //----------------------------------------------------------------------------
351 vvSlicer* vvSlicerManager::GetSlicer(int i)
355 //----------------------------------------------------------------------------
358 //----------------------------------------------------------------------------
359 void vvSlicerManager::UpdateSlicer(int num, bool state)
361 if (mSlicers[num]->GetImage())
362 mSlicers[num]->SetDisplayMode(state);
364 //----------------------------------------------------------------------------
367 //----------------------------------------------------------------------------
368 void vvSlicerManager::SetSlicerWindow(int i, vtkRenderWindow* RW)
370 mSlicers[i]->SetRenderWindow(i,RW);
372 //----------------------------------------------------------------------------
375 //----------------------------------------------------------------------------
376 void vvSlicerManager::SetInteractorStyleNavigator(int i, vtkInteractorStyle* style)
378 vvSlicerManagerCommand *smc = vvSlicerManagerCommand::New();
380 smc->SetSlicerNumber(i);
381 mSlicers[i]->GetRenderWindow()->GetInteractor()->SetInteractorStyle(style);
383 mSlicers[i]->GetRenderWindow()->GetInteractor()->
384 GetInteractorStyle()->AddObserver(vtkCommand::KeyPressEvent, smc);
385 mSlicers[i]->GetRenderWindow()->GetInteractor()->
386 GetInteractorStyle()->AddObserver(vtkCommand::WindowLevelEvent, smc);
387 mSlicers[i]->GetRenderWindow()->GetInteractor()->
388 GetInteractorStyle()->AddObserver(vtkCommand::EndWindowLevelEvent, smc);
389 mSlicers[i]->GetRenderWindow()->GetInteractor()->
390 GetInteractorStyle()->AddObserver(vtkCommand::StartWindowLevelEvent, smc);
391 mSlicers[i]->GetRenderWindow()->GetInteractor()->
392 GetInteractorStyle()->AddObserver(vtkCommand::PickEvent, smc);
393 mSlicers[i]->GetRenderWindow()->GetInteractor()->
394 GetInteractorStyle()->AddObserver(vtkCommand::StartPickEvent, smc);
395 mSlicers[i]->GetRenderWindow()->GetInteractor()->
396 GetInteractorStyle()->AddObserver(vtkCommand::LeaveEvent, smc);
397 mSlicers[i]->GetRenderWindow()->GetInteractor()->
398 GetInteractorStyle()->AddObserver(vtkCommand::UserEvent, smc);
399 mSlicers[i]->GetRenderWindow()->GetInteractor()->
400 GetInteractorStyle()->AddObserver(vtkCommand::MouseWheelForwardEvent, smc);
401 mSlicers[i]->GetRenderWindow()->GetInteractor()->
402 GetInteractorStyle()->AddObserver(vtkCommand::MouseWheelBackwardEvent, smc);
403 // mSlicers[i]->GetRenderWindow()->GetInteractor()->
404 // GetInteractorStyle()->AddObserver(vtkCommand::LeftButtonReleaseEvent, smc);
405 mSlicers[i]->GetRenderWindow()->GetInteractor()->
406 GetInteractorStyle()->AddObserver(vtkCommand::EndPickEvent, smc);
407 mSlicers[i]->GetRenderWindow()->GetInteractor()->
408 GetInteractorStyle()->AddObserver(vtkCommand::EndInteractionEvent, smc);
411 //----------------------------------------------------------------------------
414 //----------------------------------------------------------------------------
415 void vvSlicerManager::LeftButtonReleaseEvent(int slicer)
417 emit LeftButtonReleaseSignal(slicer);
419 //----------------------------------------------------------------------------
421 //----------------------------------------------------------------------------
422 void vvSlicerManager::SetSliceOrientation(int slicer, int orientation)
424 mSlicers[slicer]->SetSliceOrientation(orientation);
425 emit UpdateOrientation(slicer, orientation);
427 //----------------------------------------------------------------------------
429 //----------------------------------------------------------------------------
430 void vvSlicerManager::SetTSlice(int slice)
434 else if (slice > mSlicers[0]->GetTMax())
435 slice = mSlicers[0]->GetTMax();
437 mLandmarks->SetTime(slice);
438 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
439 if (slice != mSlicers[i]->GetTSlice()) {
440 mSlicers[i]->SetTSlice(slice);
445 //----------------------------------------------------------------------------
448 //----------------------------------------------------------------------------
449 void vvSlicerManager::SetNextTSlice(int originating_slicer)
451 int t = mSlicers[0]->GetTSlice();
453 if (t > mSlicers[0]->GetTMax())
455 //std::cout << "vvSlicerManager::SetNextTSlice" << std::endl;
456 emit UpdateTSlice(originating_slicer,t);
458 //----------------------------------------------------------------------------
461 //----------------------------------------------------------------------------
462 void vvSlicerManager::SetPreviousTSlice(int originating_slicer)
464 int t = mSlicers[0]->GetTSlice();
467 t = mSlicers[0]->GetTMax();
468 //std::cout << "vvSlicerManager::SetPreviousTSlice" << std::endl;
469 emit UpdateTSlice(originating_slicer,t);
471 //----------------------------------------------------------------------------
474 //----------------------------------------------------------------------------
475 void vvSlicerManager::ToggleInterpolation()
477 bool interpolate=!(mSlicers[0]->GetImageActor()->GetInterpolate());
478 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
479 mSlicers[i]->GetImageActor()->SetInterpolate(interpolate);
480 if (mSlicers[i]->GetOverlayActor())
481 mSlicers[i]->GetOverlayActor()->SetInterpolate(interpolate);
482 if (mSlicers[i]->GetFusionActor())
483 mSlicers[i]->GetFusionActor()->SetInterpolate(interpolate);
486 //----------------------------------------------------------------------------
489 //----------------------------------------------------------------------------
490 void vvSlicerManager::SetTSliceInSlicer(int tslice, int slicer)
494 else if (tslice > mSlicers[slicer]->GetTMax())
495 tslice = mSlicers[slicer]->GetTMax();
497 mLandmarks->SetTime(tslice);
499 if (mSlicers[slicer]->GetTSlice() == tslice) return;
501 mSlicers[slicer]->SetTSlice(tslice);
502 UpdateTSlice(slicer);
504 //----------------------------------------------------------------------------
507 //----------------------------------------------------------------------------
508 void vvSlicerManager::SetColorWindow(double s)
510 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
511 mSlicers[i]->SetColorWindow(s);
514 //----------------------------------------------------------------------------
516 //----------------------------------------------------------------------------
517 void vvSlicerManager::SetColorLevel(double s)
519 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
520 mSlicers[i]->SetColorLevel(s);
523 //----------------------------------------------------------------------------
525 //----------------------------------------------------------------------------
526 void vvSlicerManager::SetOverlayColorWindow(double s)
528 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
529 mSlicers[i]->SetOverlayColorWindow(s);
532 //----------------------------------------------------------------------------
534 //----------------------------------------------------------------------------
535 void vvSlicerManager::SetOverlayColorLevel(double s)
537 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
538 mSlicers[i]->SetOverlayColorLevel(s);
541 //----------------------------------------------------------------------------
543 //----------------------------------------------------------------------------
544 void vvSlicerManager::SetLinkOverlayWindowLevel(bool b)
546 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
547 mSlicers[i]->SetLinkOverlayWindowLevel(b);
550 //----------------------------------------------------------------------------
552 //----------------------------------------------------------------------------
553 void vvSlicerManager::SetCursorAndCornerAnnotationVisibility(int s)
555 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
556 mSlicers[i]->SetCursorVisibility(s);
557 mSlicers[i]->SetCornerAnnotationVisibility(s);
560 //----------------------------------------------------------------------------
562 //----------------------------------------------------------------------------
563 void vvSlicerManager::SetOpacity(int i, double factor)
565 mSlicers[i]->SetOpacity(1/factor);
567 //----------------------------------------------------------------------------
570 //----------------------------------------------------------------------------
571 void vvSlicerManager::UpdateViews(int current,int slicer)
573 double x = (mSlicers[slicer]->GetCurrentPosition()[0] - mSlicers[slicer]->GetInput()->GetOrigin()[0])
574 /mSlicers[slicer]->GetInput()->GetSpacing()[0];
575 double y = (mSlicers[slicer]->GetCurrentPosition()[1] - mSlicers[slicer]->GetInput()->GetOrigin()[1])
576 /mSlicers[slicer]->GetInput()->GetSpacing()[1];
577 double z = (mSlicers[slicer]->GetCurrentPosition()[2] - mSlicers[slicer]->GetInput()->GetOrigin()[2])
578 /mSlicers[slicer]->GetInput()->GetSpacing()[2];
580 if (x >= mSlicers[slicer]->GetInput()->GetWholeExtent()[0] &&
581 x <= mSlicers[slicer]->GetInput()->GetWholeExtent()[1] &&
582 y >= mSlicers[slicer]->GetInput()->GetWholeExtent()[2] &&
583 y <= mSlicers[slicer]->GetInput()->GetWholeExtent()[3] &&
584 z >= mSlicers[slicer]->GetInput()->GetWholeExtent()[4] &&
585 z <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5]) {
586 mSlicers[slicer]->UpdateCursorPosition();
587 mSlicers[slicer]->SetCursorColor(10,212,255);
589 switch (mSlicers[slicer]->GetSliceOrientation()) {
590 case vtkImageViewer2::SLICE_ORIENTATION_XY:
591 if (mSlicers[slicer]->GetSlice() != (int)floor(z))
592 mSlicers[slicer]->SetSlice((int)floor(z));
595 case vtkImageViewer2::SLICE_ORIENTATION_XZ:
596 if (mSlicers[slicer]->GetSlice() != (int)floor(y))
597 mSlicers[slicer]->SetSlice((int)floor(y));
600 case vtkImageViewer2::SLICE_ORIENTATION_YZ:
601 if (mSlicers[slicer]->GetSlice() != (int)floor(x))
602 mSlicers[slicer]->SetSlice((int)floor(x));
605 mSlicers[slicer]->Render();
607 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
608 if (i != (unsigned int)slicer
609 && mSlicers[i]->GetRenderer()->GetDraw()
610 && mSlicers[i]->GetRenderWindow()->GetSize()[0] > 2
611 && mSlicers[i]->GetRenderWindow()->GetSize()[1] > 2) {
612 mSlicers[i]->SetCurrentPosition(mSlicers[slicer]->GetCurrentPosition()[0],
613 mSlicers[slicer]->GetCurrentPosition()[1],
614 mSlicers[slicer]->GetCurrentPosition()[2],
615 mSlicers[slicer]->GetTSlice());
616 mSlicers[i]->UpdateCursorPosition();
617 if (current) { //do not display corner annotation if image is the one picked
618 mSlicers[i]->SetCurrentPosition(-VTK_DOUBLE_MAX,-VTK_DOUBLE_MAX,
619 -VTK_DOUBLE_MAX, mSlicers[slicer]->GetTSlice());
620 mSlicers[i]->SetCursorColor(255,10,212);
622 mSlicers[i]->SetCursorColor(150,10,282);
624 switch (mSlicers[i]->GetSliceOrientation()) {
625 case vtkImageViewer2::SLICE_ORIENTATION_XY:
626 if (mSlicers[i]->GetSlice() != (int)floor(z))
627 mSlicers[i]->SetSlice((int)floor(z));
630 case vtkImageViewer2::SLICE_ORIENTATION_XZ:
631 if (mSlicers[i]->GetSlice() != (int)floor(y))
632 mSlicers[i]->SetSlice((int)floor(y));
635 case vtkImageViewer2::SLICE_ORIENTATION_YZ:
636 if (mSlicers[i]->GetSlice() != (int)floor(x))
637 mSlicers[i]->SetSlice((int)floor(x));
641 mSlicers[i]->Render();
649 //----------------------------------------------------------------------------
652 //----------------------------------------------------------------------------
653 void vvSlicerManager::UpdateLinked(int slicer)
655 double x = (mSlicers[slicer]->GetCurrentPosition()[0] - mSlicers[slicer]->GetInput()->GetOrigin()[0])
656 /mSlicers[slicer]->GetInput()->GetSpacing()[0];
657 double y = (mSlicers[slicer]->GetCurrentPosition()[1] - mSlicers[slicer]->GetInput()->GetOrigin()[1])
658 /mSlicers[slicer]->GetInput()->GetSpacing()[1];
659 double z = (mSlicers[slicer]->GetCurrentPosition()[2] - mSlicers[slicer]->GetInput()->GetOrigin()[2])
660 /mSlicers[slicer]->GetInput()->GetSpacing()[2];
662 if (x >= mSlicers[slicer]->GetInput()->GetWholeExtent()[0] &&
663 x <= mSlicers[slicer]->GetInput()->GetWholeExtent()[1] &&
664 y >= mSlicers[slicer]->GetInput()->GetWholeExtent()[2] &&
665 y <= mSlicers[slicer]->GetInput()->GetWholeExtent()[3] &&
666 z >= mSlicers[slicer]->GetInput()->GetWholeExtent()[4] &&
667 z <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5]) {
668 for (std::list<std::string>::const_iterator i = mLinkedId.begin(); i != mLinkedId.end(); i++) {
669 emit UpdateLinkManager(*i, slicer,mSlicers[slicer]->GetCurrentPosition()[0],
670 mSlicers[slicer]->GetCurrentPosition()[1],
671 mSlicers[slicer]->GetCurrentPosition()[2],mSlicers[slicer]->GetTSlice());
675 //----------------------------------------------------------------------------
677 //----------------------------------------------------------------------------
678 void vvSlicerManager::UpdateLinkedNavigation(vvSlicer *refSlicer, bool bPropagate)
680 vtkCamera *refCam = refSlicer->GetRenderer()->GetActiveCamera();
681 double refPosition[3], refFocal[3];
682 refCam->GetPosition(refPosition);
683 refCam->GetFocalPoint(refFocal);
685 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
686 vtkCamera *camera = mSlicers[i]->GetRenderer()->GetActiveCamera();
687 camera->SetParallelScale(refCam->GetParallelScale());
689 double position[3], focal[3];
690 camera->GetPosition(position);
691 camera->GetFocalPoint(focal);
693 if(refSlicer->GetSliceOrientation()==mSlicers[i]->GetSliceOrientation()) {
694 for(int i=0; i<3; i++) {
695 position[i] = refPosition[i];
696 focal[i] = refFocal[i];
700 if(refSlicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XY) {
701 if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XZ) {
702 position[0] = refPosition[0];
703 focal[0] = refFocal[0];
705 if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_YZ) {
706 position[1] = refPosition[1];
707 focal[1] = refFocal[1];
711 if(refSlicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XZ) {
712 if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_YZ) {
713 position[2] = refPosition[2];
714 focal[2] = refFocal[2];
716 if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XY) {
717 position[0] = refPosition[0];
718 focal[0] = refFocal[0];
722 if(refSlicer->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_YZ) {
723 if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XY) {
724 position[1] = refPosition[1];
725 focal[1] = refFocal[1];
727 if(mSlicers[i]->GetSliceOrientation()==vtkImageViewer2::SLICE_ORIENTATION_XZ) {
728 position[2] = refPosition[2];
729 focal[2] = refFocal[2];
733 camera->SetFocalPoint(focal);
734 camera->SetPosition(position);
737 mSlicers[i]->ForceUpdateDisplayExtent();
742 for (std::list<std::string>::const_iterator i = mLinkedId.begin(); i != mLinkedId.end(); i++)
743 emit UpdateLinkedNavigation(*i, this, refSlicer);
745 //----------------------------------------------------------------------------
747 //----------------------------------------------------------------------------
748 double vvSlicerManager::GetColorWindow()
751 return mSlicers[0]->GetColorWindow();
754 //----------------------------------------------------------------------------
757 //----------------------------------------------------------------------------
758 double vvSlicerManager::GetColorLevel()
761 return mSlicers[0]->GetColorLevel();
764 //----------------------------------------------------------------------------
766 //----------------------------------------------------------------------------
767 double vvSlicerManager::GetOverlayColorWindow() const
770 return mSlicers[0]->GetOverlayColorWindow();
773 //----------------------------------------------------------------------------
775 //----------------------------------------------------------------------------
776 double vvSlicerManager::GetOverlayColorLevel() const
779 return mSlicers[0]->GetOverlayColorLevel();
782 //----------------------------------------------------------------------------
784 //----------------------------------------------------------------------------
785 bool vvSlicerManager::GetLinkOverlayWindowLevel() const
788 return mSlicers[0]->GetLinkOverlayWindowLevel();
791 //----------------------------------------------------------------------------
793 //------------------------------------------------------------------------------
794 void vvSlicerManager::ResetTransformationToIdentity(const std::string actorType)
796 if(actorType == "image")
797 this->GetImage()->GetTransform()->Identity();
798 else if(actorType == "overlay")
799 this->GetSlicer(0)->GetOverlay()->GetTransform()->Identity();
800 else if(actorType == "fusion")
801 this->GetSlicer(0)->GetFusion()->GetTransform()->Identity();
802 else if(actorType == "vf")
803 this->GetVF()->GetTransform()->Identity();
807 for(int i=0; i< this->GetNumberOfSlicers(); i++){
808 this->GetSlicer(i)->ForceUpdateDisplayExtent();
809 this->GetSlicer(i)->ResetCamera();
810 this->GetSlicer(i)->Render();
813 //------------------------------------------------------------------------------
815 //----------------------------------------------------------------------------
816 void vvSlicerManager::Render()
818 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
819 mSlicers[i]->Render();
822 //----------------------------------------------------------------------------
825 //----------------------------------------------------------------------------
826 void vvSlicerManager::GenerateDefaultLookupTable()
829 SetColorMap(mColorMap);
831 //----------------------------------------------------------------------------
834 //----------------------------------------------------------------------------
835 void vvSlicerManager::Reload()
837 mReader->Update(mType);
838 mImage=mReader->GetOutput();
839 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
840 mSlicers[i]->SetImage(mImage);
843 //----------------------------------------------------------------------------
846 //----------------------------------------------------------------------------
847 void vvSlicerManager::ReloadFusion()
849 mFusionReader->Update(mImage->GetNumberOfDimensions(),mFusionComponent.c_str(),mType);
851 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
852 mSlicers[i]->SetFusion(mFusionReader->GetOutput());
853 mSlicers[i]->Render();
856 //----------------------------------------------------------------------------
859 //----------------------------------------------------------------------------
860 void vvSlicerManager::ReloadOverlay()
862 mOverlayReader->Update(mImage->GetNumberOfDimensions(),mOverlayComponent.c_str(),mType);
863 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
864 mSlicers[i]->SetOverlay(mOverlayReader->GetOutput());
865 mSlicers[i]->Render();
868 //----------------------------------------------------------------------------
871 //----------------------------------------------------------------------------
872 void vvSlicerManager::ReloadVF()
874 mVectorReader->Update(vvImageReader::VECTORFIELD); //deletes the old images through the VF::Init() function
875 mVF=mVectorReader->GetOutput();
876 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
877 mSlicers[i]->SetVF(mVF);
878 mSlicers[i]->Render();
881 //----------------------------------------------------------------------------
884 //----------------------------------------------------------------------------
885 void vvSlicerManager::RemoveActor(const std::string& actor_type, int overlay_index)
887 if (actor_type =="overlay")
888 mOverlayReader = NULL;
890 if (actor_type =="fusion")
891 mFusionReader = NULL;
893 for (unsigned int i = 0; i < mSlicers.size(); i++)
894 mSlicers[i]->RemoveActor(actor_type,overlay_index);
896 if (actor_type=="vector") {
901 //----------------------------------------------------------------------------
904 //----------------------------------------------------------------------------
905 void vvSlicerManager::RemoveActors()
907 ///This method leaks a few objects. See RemoveActor for what a
908 ///correct implementation would look like
909 //DS -> probably due to the reader (now released in the
910 //RemoveActor() function. (I hope)
911 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
912 mSlicers[i]->SetDisplayMode(0);
913 mSlicers[i]->GetRenderer()->RemoveActor(mSlicers[i]->GetImageActor());
916 //----------------------------------------------------------------------------
919 //----------------------------------------------------------------------------
920 void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer)
922 // int view = mSlicers[slicer]->GetSliceOrientation();
923 // int slice = mSlicers[slicer]->GetSlice();
924 double x = mSlicers[slicer]->GetCursorPosition()[0];
925 double y = mSlicers[slicer]->GetCursorPosition()[1];
926 double z = mSlicers[slicer]->GetCursorPosition()[2];
927 double X = (x - mSlicers[slicer]->GetInput()->GetOrigin()[0])/
928 mSlicers[slicer]->GetInput()->GetSpacing()[0];
929 double Y = (y - mSlicers[slicer]->GetInput()->GetOrigin()[1])/
930 mSlicers[slicer]->GetInput()->GetSpacing()[1];
931 double Z = (z - mSlicers[slicer]->GetInput()->GetOrigin()[2])/
932 mSlicers[slicer]->GetInput()->GetSpacing()[2];
933 double value = -VTK_DOUBLE_MAX;
935 double xVec=0, yVec=0, zVec=0, valueVec=0;
938 double valueOver=0, valueFus=0;
939 if (X >= mSlicers[slicer]->GetInput()->GetWholeExtent()[0] &&
940 X <= mSlicers[slicer]->GetInput()->GetWholeExtent()[1] &&
941 Y >= mSlicers[slicer]->GetInput()->GetWholeExtent()[2] &&
942 Y <= mSlicers[slicer]->GetInput()->GetWholeExtent()[3] &&
943 Z >= mSlicers[slicer]->GetInput()->GetWholeExtent()[4] &&
944 Z <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5]) {
945 value = this->GetScalarComponentAsDouble(mSlicers[slicer]->GetInput(), X, Y, Z);
947 if (mSlicers[slicer]->GetVFActor() ) {
949 unsigned int currentTime = mSlicers[slicer]->GetTSlice();
950 vtkImageData *vf = NULL;
952 if (mSlicers[slicer]->GetVF()->GetVTKImages().size() > currentTime)
953 vf = mSlicers[slicer]->GetVF()->GetVTKImages()[currentTime];
955 vf = mSlicers[slicer]->GetVF()->GetVTKImages()[0];
958 double Xvf = (x - vf->GetOrigin()[0])/ vf->GetSpacing()[0];
959 double Yvf = (y - vf->GetOrigin()[1])/ vf->GetSpacing()[1];
960 double Zvf = (z - vf->GetOrigin()[2])/ vf->GetSpacing()[2];
961 xVec = this->GetScalarComponentAsDouble( vf, Xvf, Yvf, Zvf, 0);
962 yVec = this->GetScalarComponentAsDouble( vf, Xvf, Yvf, Zvf, 1);
963 zVec = this->GetScalarComponentAsDouble( vf, Xvf, Yvf, Zvf, 2);
964 valueVec = sqrt(xVec*xVec + yVec*yVec + zVec*zVec);
967 if (mSlicers[slicer]->GetOverlayActor() ) {
969 vtkImageData *overlay = dynamic_cast<vtkImageData*>(mSlicers[slicer]->GetOverlayMapper()->GetInput());
970 double Xover = (x - overlay->GetOrigin()[0]) / overlay->GetSpacing()[0];
971 double Yover = (y - overlay->GetOrigin()[1]) / overlay->GetSpacing()[1];
972 double Zover = (z - overlay->GetOrigin()[2]) / overlay->GetSpacing()[2];
973 valueOver = this->GetScalarComponentAsDouble(overlay, Xover, Yover, Zover);
975 if (mSlicers[slicer]->GetFusionActor() ) {
977 vtkImageData *fusion = dynamic_cast<vtkImageData*>(mSlicers[slicer]->GetFusionMapper()->GetInput());
978 double Xover = (x - fusion->GetOrigin()[0]) / fusion->GetSpacing()[0];
979 double Yover = (y - fusion->GetOrigin()[1]) / fusion->GetSpacing()[1];
980 double Zover = (z - fusion->GetOrigin()[2]) / fusion->GetSpacing()[2];
981 valueFus = this->GetScalarComponentAsDouble(fusion, Xover, Yover, Zover);
983 emit UpdatePosition(mSlicers[slicer]->GetCursorVisibility(),
985 emit UpdateVector(displayVec,xVec, yVec, zVec, valueVec);
986 emit UpdateOverlay(displayOver,valueOver,value);
987 emit UpdateFusion(displayFus,valueFus);
990 //----------------------------------------------------------------------------
993 //----------------------------------------------------------------------------
994 void vvSlicerManager::Activated()
996 emit currentImageChanged(mId);
998 //----------------------------------------------------------------------------
1001 //----------------------------------------------------------------------------
1002 void vvSlicerManager::Picked()
1004 emit currentPickedImageChanged(mId);
1006 //----------------------------------------------------------------------------
1009 //----------------------------------------------------------------------------
1010 void vvSlicerManager::UpdateWindowLevel()
1012 emit WindowLevelChanged();
1014 //----------------------------------------------------------------------------
1017 //----------------------------------------------------------------------------
1018 void vvSlicerManager::UpdateSlice(int slicer)
1020 if (mPreviousSlice[slicer] == mSlicers[slicer]->GetSlice()) {
1021 //DD("============= NOTHING");
1024 //std::cout << "vvSlicerManager::UpdateSlice " << slicer << " " << mSlicers[slicer]->GetSlice() << std::endl;
1025 emit UpdateSlice(slicer, mSlicers[slicer]->GetSlice());
1026 mSlicers[slicer]->Render(); // DS <-- I add this, this could/must be the only Render ...
1027 mPreviousSlice[slicer] = mSlicers[slicer]->GetSlice();
1029 //----------------------------------------------------------------------------
1032 //----------------------------------------------------------------------------
1033 void vvSlicerManager::UpdateTSlice(int slicer)
1035 int slice = mSlicers[slicer]->GetSlice();
1036 int tslice = mSlicers[slicer]->GetTSlice();
1037 if (mPreviousSlice[slicer] == slice) {
1038 if (mPreviousTSlice[slicer] == tslice) {
1039 // DD("************** NOTHING ***********");
1043 mPreviousSlice[slicer] = slice;
1044 mPreviousTSlice[slicer] = tslice;
1045 //std::cout << "vvSlicerManager::UpdateTSlice " << slicer << " " << tslice << std::endl;
1046 emit UpdateTSlice(slicer, tslice);
1048 //----------------------------------------------------------------------------
1051 //----------------------------------------------------------------------------
1052 void vvSlicerManager::UpdateSliceRange(int slicer)
1054 emit UpdateSliceRange(slicer,
1055 mSlicers[slicer]->GetSliceRange()[0], mSlicers[slicer]->GetSliceRange()[1],
1056 0,mSlicers[slicer]->GetTMax());
1058 //----------------------------------------------------------------------------
1061 //----------------------------------------------------------------------------
1062 void vvSlicerManager::SetPreset(int preset)
1064 //vtkLookupTable* LUT = static_cast<vtkLookupTable*>(mSlicers[0]->GetWindowLevel()->GetLookupTable());
1065 double window = mSlicers[0]->GetColorWindow();
1066 double level = mSlicers[0]->GetColorLevel();
1068 std::string component_type=mImage->GetScalarTypeAsITKString();
1072 mImage->GetScalarRange(range);
1073 window = range[1] - range[0];
1074 level = (range[1] + range[0])* 0.5;
1104 this->SetColorWindow(window);
1105 this->SetColorLevel(level);
1112 //----------------------------------------------------------------------------
1115 //----------------------------------------------------------------------------
1116 void vvSlicerManager::SetLocalColorWindowing(const int slicer, const bool bCtrlKey)
1119 int t = this->mSlicers[slicer]->GetTSlice();
1120 if(bCtrlKey && this->mSlicers[slicer]->GetFusion()) {
1121 this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max,
1122 this->mSlicers[slicer]->GetFusion()->GetVTKImages()[t],
1123 this->mSlicers[slicer]->GetFusion()->GetTransform());
1124 this->SetFusionWindow(max-min);
1125 this->SetFusionLevel(0.5*(min+max));
1126 this->SetColorMap(mColorMap);
1128 else if(bCtrlKey && this->mSlicers[slicer]->GetOverlay()) {
1129 this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max,
1130 this->mSlicers[slicer]->GetOverlay()->GetVTKImages()[t],
1131 this->mSlicers[slicer]->GetOverlay()->GetTransform());
1132 if(this->mSlicers[slicer]->GetLinkOverlayWindowLevel()){
1133 this->SetColorWindow(max-min);
1134 this->SetColorLevel(0.5*(min+max));
1136 this->SetOverlayColorWindow(max-min);
1137 this->SetOverlayColorLevel(0.5*(min+max));
1141 this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max,
1142 this->mSlicers[slicer]->GetImage()->GetVTKImages()[t],
1143 this->mSlicers[slicer]->GetImage()->GetTransform());
1144 this->SetColorWindow(max-min);
1145 this->SetColorLevel(0.5*(min+max));
1149 this->UpdateWindowLevel();
1151 //----------------------------------------------------------------------------
1154 //----------------------------------------------------------------------------
1155 void vvSlicerManager::SetColorMap(int colormap)
1158 range[0] = mSlicers[0]->GetInput()->GetScalarRange()[0];
1159 range[1] = mSlicers[0]->GetInput()->GetScalarRange()[1];
1161 double window = mSlicers[0]->GetWindowLevel()->GetWindow();
1162 double level = mSlicers[0]->GetWindowLevel()->GetLevel();
1164 vtkLookupTable* LUT = static_cast<vtkLookupTable*>(mSlicers[0]->GetWindowLevel()->GetLookupTable());
1173 LUT = vtkLookupTable::New();
1174 LUT->SetValueRange(0,1);
1175 LUT->SetSaturationRange(1,1);
1176 LUT->SetHueRange(0,0.18);
1180 LUT = vtkLookupTable::New();
1181 LUT->SetValueRange(0,1);
1182 LUT->SetSaturationRange(1,1);
1183 LUT->SetHueRange(0.4,0.80);
1187 LUT = vtkLookupTable::New();
1188 LUT->SetValueRange(0.5,1);
1189 LUT->SetSaturationRange(1,1);
1190 LUT->SetHueRange(0.666,0);
1194 LUT = vtkLookupTable::New();
1195 LUT->SetValueRange(1,1);
1196 LUT->SetSaturationRange(1,1);
1197 LUT->SetHueRange(0,1);
1198 LUT->SetAlphaRange(1, 1);
1202 LUT = vtkLookupTable::New();
1203 LUT->SetValueRange(1,1);
1204 LUT->SetSaturationRange(1,1);
1205 LUT->SetHueRange(1,0.1);
1206 //LUT->SetRampToLinear();
1210 LUT->SetTableRange(level-fabs(window)/2,level+fabs(window)/2);
1213 vtkWindowLevelLookupTable* fusLUT = NULL;
1214 if (mSlicers[0]->GetFusion()) { // && mFusionColorMap >= 0) {
1215 fusLUT = vtkWindowLevelLookupTable::New();
1216 double fusRange [2];
1217 fusRange[0] = mFusionLevel - mFusionWindow/2;
1218 fusRange[1] = mFusionLevel + mFusionWindow/2;
1219 double* frange = mFusionReader->GetOutput()->GetVTKImages()[0]->GetScalarRange();
1220 fusLUT->SetTableRange(frange);
1221 fusLUT->SetValueRange(1,1);
1222 fusLUT->SetSaturationRange(1,1);
1223 fusLUT->SetAlphaRange(1, 1);
1224 fusLUT->SetWindow(mFusionWindow);
1225 fusLUT->SetLevel(mFusionLevel);
1226 if (mFusionColorMap == 1)
1227 fusLUT->SetHueRange(0,0.18);
1228 else if (mFusionColorMap == 2)
1229 fusLUT->SetHueRange(0.4,0.80);
1230 else if (mFusionColorMap == 3)
1232 fusLUT->SetHueRange(0.666, 0);
1233 fusLUT->SetValueRange(0.5, 1);
1235 else if (mFusionColorMap == 4)
1236 fusLUT->SetHueRange(0,1);
1237 else if (mFusionColorMap <= 0)
1239 fusLUT->SetValueRange(0,1);
1240 fusLUT->SetSaturationRange(0,0);
1243 fusLUT->ForceBuild();
1246 // set color table transparency
1247 //double alpha_range=(double)mFusionThresOpacity/10;
1248 double range_end = fusRange[0] + (double)mFusionThresOpacity*(fusRange[1] - fusRange[0])/100;
1249 double curr_value = fusRange[0];
1250 int nvalues = fusLUT->GetNumberOfTableValues();
1251 for (double i = 0; curr_value < range_end; i++) {
1252 fusLUT->GetTableValue(i, v);
1254 //if (curr_value >= -alpha_range && curr_value <= alpha_range) v[3] = pow(fabs(curr_value/alpha_range),2);
1256 fusLUT->SetTableValue(i, v);
1257 curr_value += (fusRange[1] - fusRange[0])/nvalues;
1260 for ( unsigned int i = 0; i < mSlicers.size(); i++) {
1262 if (mSlicers[i]->GetOverlay()) {
1263 vtkLookupTable* supLUT = vtkLookupTable::New();
1264 supLUT->SetTableRange(range[0],range[1]);
1265 supLUT->SetValueRange(1,1);
1266 supLUT->SetSaturationRange(1,1);
1267 supLUT->SetHueRange(double(mOverlayColor)/360,double(mOverlayColor)/360);
1269 vtkLookupTable* invLUT = vtkLookupTable::New();
1270 invLUT->SetTableRange(range[0],range[1]);
1271 invLUT->SetValueRange(1,1);
1272 invLUT->SetSaturationRange(1,1);
1273 invLUT->SetHueRange(double((mOverlayColor+180)%360)/360,double((mOverlayColor+180)%360)/360);
1275 dynamic_cast<vvImageMapToWLColors*>(mSlicers[i]->GetWindowLevel())
1276 ->SetWindowLevelMode(true);
1277 mSlicers[i]->GetWindowLevel()->SetLookupTable(supLUT);
1278 mSlicers[i]->GetOverlayMapper()->SetLookupTable(invLUT);
1281 } else if (mSlicers[i]->GetOverlay()) {
1282 //dynamic_cast<vvImageMapToWLColors*>(mSlicers[i]->GetWindowLevel())
1283 //->SetWindowLevelMode(false);
1284 mSlicers[i]->GetWindowLevel()->SetLookupTable(LUT);
1286 mSlicers[i]->GetWindowLevel()->SetLookupTable(LUT);
1289 if (mSlicers[i]->GetFusion()) {
1290 mSlicers[i]->ShowFusionLegend(mFusionShowLegend);
1291 mSlicers[i]->GetFusionMapper()->SetLookupTable(fusLUT);
1292 mSlicers[i]->GetFusionActor()->SetOpacity(double(mFusionOpacity)/100);
1298 mColorMap = colormap;
1300 //----------------------------------------------------------------------------
1303 //----------------------------------------------------------------------------
1304 vvLandmarks* vvSlicerManager::GetLandmarks()
1306 if (mLandmarks == NULL) {
1307 mLandmarks = new vvLandmarks(mSlicers[0]->GetTMax()+1);
1308 for (unsigned int i = 0; i < mSlicers.size(); i++)
1309 mSlicers[i]->SetLandmarks(mLandmarks);
1313 //----------------------------------------------------------------------------
1316 //----------------------------------------------------------------------------
1317 void vvSlicerManager::AddLandmark(float x,float y,float z,float t)
1319 double x_index = (x - mSlicers[0]->GetInput()->GetOrigin()[0])/mSlicers[0]->GetInput()->GetSpacing()[0];
1320 double y_index = (y - mSlicers[0]->GetInput()->GetOrigin()[1])/mSlicers[0]->GetInput()->GetSpacing()[1];
1321 double z_index = (z - mSlicers[0]->GetInput()->GetOrigin()[2])/mSlicers[0]->GetInput()->GetSpacing()[2];
1322 if (x_index >= mSlicers[0]->GetInput()->GetWholeExtent()[0] &&
1323 x_index <= mSlicers[0]->GetInput()->GetWholeExtent()[1] &&
1324 y_index >= mSlicers[0]->GetInput()->GetWholeExtent()[2] &&
1325 y_index <= mSlicers[0]->GetInput()->GetWholeExtent()[3] &&
1326 z_index >= mSlicers[0]->GetInput()->GetWholeExtent()[4] &&
1327 z_index <= mSlicers[0]->GetInput()->GetWholeExtent()[5]) {
1328 double value = this->GetScalarComponentAsDouble(mSlicers[0]->GetInput(), x_index, y_index, z_index);
1329 this->GetLandmarks()->AddLandmark(x,y,z,t,value);
1330 emit LandmarkAdded();
1333 //----------------------------------------------------------------------------
1335 //----------------------------------------------------------------------------
1336 void vvSlicerManager::PrevImage(int slicer)
1338 emit ChangeImageWithIndexOffset(this, slicer, -1);
1340 //----------------------------------------------------------------------------
1342 //----------------------------------------------------------------------------
1343 void vvSlicerManager::NextImage(int slicer)
1345 emit ChangeImageWithIndexOffset(this, slicer, 1);
1347 //----------------------------------------------------------------------------
1349 //----------------------------------------------------------------------------
1350 void vvSlicerManager::VerticalSliderHasChanged(int slicer, int slice)
1352 emit AVerticalSliderHasChanged(slicer, slice);
1355 //----------------------------------------------------------------------------
1357 //----------------------------------------------------------------------------
1358 double vvSlicerManager::GetScalarComponentAsDouble(vtkImageData *image, double X, double Y, double Z, int component)
1361 return mSlicers[0]->GetScalarComponentAsDouble(image, X, Y, Z, ix, iy, iz, component);
1363 //----------------------------------------------------------------------------