]> Creatis software - clitk.git/blob - vv/vvSlicer.cxx
binarize
[clitk.git] / vv / vvSlicer.cxx
1 /*=========================================================================
2
3   Program:   vv
4   Language:  C++
5   Author :   Pierre Seroul (pierre.seroul@gmail.com)
6
7   Copyright (C) 2008
8   Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
9   CREATIS-LRMN http://www.creatis.insa-lyon.fr
10
11   This program is free software: you can redistribute it and/or modify
12   it under the terms of the GNU General Public License as published by
13   the Free Software Foundation, version 3 of the License.
14
15   This program is distributed in the hope that it will be useful,
16   but WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18   GNU General Public License for more details.
19
20   You should have received a copy of the GNU General Public License
21   along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
23   =========================================================================*/
24 #include "vvSlicer.h"
25
26 #include "vvImage.h"
27 #include "vvSlicerManagerCommand.h"
28 #include "vvGlyphSource.h"
29 #include "vvGlyph2D.h"
30 #include "vvImageMapToWLColors.h"
31
32 #include <vtkTextProperty.h>
33 #include <vtkTextActor.h>
34 #include <vtkTextSource.h>
35 #include <vtkActor2D.h>
36 #include <vtkCursor2D.h>
37 #include <vtkPolyDataMapper2D.h>
38 #include <vtkProperty2D.h>
39 #include <vtkCornerAnnotation.h>
40 #include <vtkImageMapToWindowLevelColors.h>
41 #include <vtkImageData.h>
42 #include <vtkImageActor.h>
43 #include <vtkToolkits.h>
44 #include <vtkObjectFactory.h>
45 #include <vtkPointData.h>
46 #include <vtkDataArray.h>
47 #include <vtkFloatArray.h>
48 #include <vtkClipPolyData.h>
49 #include <vtkGlyph3D.h>
50 #include <vtkMath.h>
51 #include <vtkCursor3D.h>
52 #include <vtkProperty.h>
53 #include <vtkLight.h>
54 #include <vtkLightCollection.h>
55 #include <vtkScalarBarActor.h>
56 #include <vtkLookupTable.h>
57
58 #include <vtkRenderer.h>
59 #include <vtkRendererCollection.h>
60 #include <vtkRenderWindow.h>
61 #include <vtkRenderWindowInteractor.h>
62 #include <vtkCamera.h>
63 #include <vtkCallbackCommand.h>
64 #include <vtkCommand.h>
65 #include <vtkPolyDataMapper.h>
66 #include <vtkBox.h>
67
68 #include <vtkExtractVOI.h>
69 #include <vtkSphereSource.h>
70 #include <vtkCutter.h>
71 #include <vtkPlane.h>
72 #include <vtkAssignAttribute.h>
73
74 vtkCxxRevisionMacro(vvSlicer, "DummyRevision");
75 vtkStandardNewMacro(vvSlicer);
76
77 vvSlicer::vvSlicer()
78 {
79   mImage = NULL;
80   mCurrentTSlice = 0;
81
82   mCurrent[0] = -VTK_DOUBLE_MAX;
83   mCurrent[1] = -VTK_DOUBLE_MAX;
84   mCurrent[2] = -VTK_DOUBLE_MAX;
85
86   mCursor[0] = -VTK_DOUBLE_MAX;
87   mCursor[1] = -VTK_DOUBLE_MAX;
88   mCursor[2] = -VTK_DOUBLE_MAX;
89   mCursor[3] = -VTK_DOUBLE_MAX;
90
91   mSubSampling = 5;
92   mScale = 1;
93   mVFLog = 0;
94
95   std::string text = "F1 = sagital; F2 = coronal; F3 = axial\n";
96   text += "F5 = horizontal flip; F6 = vertical flip\n\n";
97   text += "0,1,2,3,4,5 : preset windowing\n";
98   text += "6,7,8,9 : preset colormap\n";
99   text += "r : reset view\n";
100   text += "l : reload image\n";
101   text += "f : fly to mouse position\n";
102   text += "g : go to cross hair position\n\n";
103   text += "Up,down : change slice\n";
104   text += "Left,right : change tenporal slice\n\n";
105   text += "Scrollbar (or w/x) : zoom in/out\n";
106   text += "left button : synchronize all views\n";
107   text += "middle button : grab image\n";
108   text += "right button : change windowing\n";
109
110   crossCursor = vtkCursor2D::New();
111   crossCursor->AllOff();
112   crossCursor->AxesOn();
113   crossCursor->SetTranslationMode(1);
114   crossCursor->SetRadius(2);
115
116   pdm = vtkPolyDataMapper2D::New();
117   pdm->SetInput(crossCursor->GetOutput());
118
119   pdmA = vtkActor2D::New();
120   pdmA->SetMapper(pdm);
121   pdmA->GetProperty()->SetColor(255,10,212);
122   pdmA->SetVisibility(0);
123   pdmA->SetPickable(0);
124
125   ca = vtkCornerAnnotation::New();
126   ca->GetTextProperty()->SetColor(255,10,212);
127   ca->SetVisibility(1);
128   mFileName = "";
129
130   mVF = NULL;
131   mOverlay = NULL;
132   mFusion = NULL;
133   mLandmarks = NULL;
134
135   legend = vtkSmartPointer<vtkScalarBarActor>::New();
136   //legend->SetTitle("test!");
137   legend->SetPosition(0.82,0.18);
138   legend->SetWidth(0.1);
139   legend->SetVisibility(0);
140   legend->SetLabelFormat("%.1f");
141   this->GetRenderer()->AddActor(legend);
142
143   this->WindowLevel->Delete();
144   this->WindowLevel = vvImageMapToWLColors::New();
145   this->InstallPipeline();
146 }
147
148 vtkImageMapToWindowLevelColors* vvSlicer::GetOverlayMapper() {
149   return mOverlayMapper.GetPointer();
150 }
151 vtkImageActor* vvSlicer::GetOverlayActor() {
152   return mOverlayActor.GetPointer();
153 }
154 vtkImageMapToWindowLevelColors* vvSlicer::GetFusionMapper() {
155   return mFusionMapper.GetPointer();
156 }
157     
158 vtkImageActor* vvSlicer::GetFusionActor() {
159   return mFusionActor.GetPointer();
160 }
161 vtkActor* vvSlicer::GetVFActor() {
162   return mVFActor.GetPointer();
163 }
164 vtkCornerAnnotation* vvSlicer::GetAnnotation() {
165   return ca.GetPointer();
166 }
167
168 void vvSlicer::AddContour(vvMesh::Pointer contour,bool propagate)
169 {
170
171   mSurfaceCutActors.push_back(new vvMeshActor());
172   if (propagate)
173     mSurfaceCutActors.back()->Init(contour,mCurrentTSlice,mVF);
174   else
175     mSurfaceCutActors.back()->Init(contour,mCurrentTSlice);
176   mSurfaceCutActors.back()->SetSlicingOrientation(SliceOrientation);
177   this->GetRenderer()->AddActor(mSurfaceCutActors.back()->GetActor());
178
179   SetContourSlice();
180 }
181
182 void vvSlicer::ToggleContourSuperposition()
183 {
184   for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
185        i!=mSurfaceCutActors.end();i++)
186     (*i)->ToggleSuperposition();
187 }
188
189 void vvSlicer::SetCursorColor(int r,int g, int b)
190 {
191   pdmA->GetProperty()->SetColor(r,g,b);
192 }
193 void vvSlicer::SetCursorVisibility(bool s)
194 {
195   pdmA->SetVisibility(s);
196 }
197 bool vvSlicer::GetCursorVisibility()
198 {
199   return pdmA->GetVisibility();
200 }
201
202 vvSlicer::~vvSlicer()
203 {
204   for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
205        i!=mSurfaceCutActors.end();i++)
206     delete (*i);
207 }
208
209 void vvSlicer::SetCurrentPosition(double x, double y, double z, int t)
210 {
211   mCurrent[0] = x;
212   mCurrent[1] = y;
213   mCurrent[2] = z;
214   mCurrentTSlice = t;
215 }
216
217 void vvSlicer::SetImage(vvImage::Pointer image)
218 {
219   if (image->GetVTKImages().size())
220     {
221       mImage = image;
222       this->Superclass::SetInput(image->GetVTKImages()[0]);
223       this->UpdateDisplayExtent();
224       mCurrentTSlice = 0;
225       ca->SetText(0,mFileName.c_str());
226     }
227 }
228
229 void vvSlicer::SetOverlay(vvImage::Pointer overlay)
230 {
231   if (overlay->GetVTKImages().size())
232     {
233       mOverlay = overlay;
234
235       if (!mOverlayMapper)
236         mOverlayMapper = vtkImageMapToWindowLevelColors::New();
237       mOverlayMapper->SetInput(overlay->GetVTKImages()[0]);
238
239       if (!mOverlayActor)
240         {
241           mOverlayActor = vtkImageActor::New();
242           mOverlayActor->SetInput(mOverlayMapper->GetOutput());
243           mOverlayActor->SetPickable(0);
244           mOverlayActor->SetVisibility(false);
245           mOverlayActor->SetOpacity(0.5);
246           this->UpdateDisplayExtent();
247         }
248
249       //stupid but necessary : the Overlay need to be rendered before fusion
250       if (mFusionActor)
251         {
252           this->GetRenderer()->RemoveActor(mFusionActor);
253           this->GetRenderer()->AddActor(mOverlayActor);
254           this->GetRenderer()->AddActor(mFusionActor);
255         }
256       else
257         this->GetRenderer()->AddActor(mOverlayActor);
258
259       //Synchronize slice
260       SetTSlice(mCurrentTSlice);
261     }
262 }
263
264 void vvSlicer::SetFusion(vvImage::Pointer fusion)
265 {
266   if (fusion->GetVTKImages().size())
267     {
268       mFusion = fusion;
269
270       if (!mFusionMapper)
271         mFusionMapper = vtkImageMapToWindowLevelColors::New();
272       mFusionMapper->SetInput(fusion->GetVTKImages()[0]);
273
274       if (!mFusionActor)
275         {
276           mFusionActor = vtkImageActor::New();
277           mFusionActor->SetInput(mFusionMapper->GetOutput());
278           mFusionActor->SetPickable(0);
279           mFusionActor->SetVisibility(false);
280           mFusionActor->SetOpacity(0.7);
281           this->UpdateDisplayExtent();
282           this->GetRenderer()->AddActor(mFusionActor);
283         }
284
285       //Synchronize slice
286       SetTSlice(mCurrentTSlice);
287     }
288 }
289
290 void vvSlicer::SetActorVisibility(const std::string& actor_type, int overlay_index ,bool vis)
291 {
292   if (actor_type == "vector")
293     {
294       this->mVFActor->SetVisibility(vis);
295     }
296   if (actor_type == "overlay")
297     {
298       this->mOverlayActor->SetVisibility(vis);
299     }
300   if (actor_type == "fusion")
301     {
302       this->mFusionActor->SetVisibility(vis);
303     }
304   if (actor_type == "contour")
305     this->mSurfaceCutActors[overlay_index]->GetActor()->SetVisibility(vis);
306   UpdateDisplayExtent();
307 }
308
309 void vvSlicer::SetVF(vvImage::Pointer vf)
310 {
311   if (vf->GetVTKImages().size())
312     {
313       mVF = vf;
314
315       if (!mAAFilter)
316         {
317           mAAFilter=vtkAssignAttribute::New();
318           mVOIFilter = vtkExtractVOI::New();
319           mVOIFilter->SetSampleRate(mSubSampling,mSubSampling,mSubSampling);
320         }
321       mVOIFilter->SetInput(vf->GetVTKImages()[0]);
322       mAAFilter->SetInput(mVOIFilter->GetOutput());
323       ///This tells VTK to use the scalar (pixel) data of the image to draw the little arrows
324       mAAFilter->Assign(vtkDataSetAttributes::SCALARS, vtkDataSetAttributes::VECTORS, vtkAssignAttribute::POINT_DATA);
325
326       if (!mArrow)
327         mArrow = vvGlyphSource::New();
328       mArrow->SetGlyphTypeToSpecificArrow();
329       mArrow->SetScale(mScale);
330       mArrow->FilledOff();
331
332       // Glyph the gradient vector (with arrows)
333       if (!mGlyphFilter)
334         mGlyphFilter = vvGlyph2D::New();
335       mGlyphFilter->SetInput(mAAFilter->GetOutput());
336       mGlyphFilter->SetSource(mArrow->GetOutput());
337       mGlyphFilter->ScalingOn();
338       mGlyphFilter->SetScaleModeToScaleByVector();
339       mGlyphFilter->OrientOn();
340       mGlyphFilter->SetVectorModeToUseVector();
341       mGlyphFilter->SetColorModeToColorByVector();
342
343       if (!mVFMapper)
344         mVFMapper = vtkPolyDataMapper::New();
345       //mVFMapper->SetInputConnection(mGlyphFilter->GetOutputPort());
346       mVFMapper->SetInput(mGlyphFilter->GetOutput());
347       mVFMapper->ImmediateModeRenderingOn();
348
349       if (!mVFActor)
350         mVFActor = vtkActor::New();
351       mVFActor->SetMapper(mVFMapper);
352       mVFActor->SetPickable(0);
353       this->UpdateDisplayExtent();
354       this->GetRenderer()->AddActor(mVFActor);
355
356       //Synchronize slice
357       SetTSlice(mCurrentTSlice);
358     }
359 }
360
361 void vvSlicer::SetLandmarks(vvLandmarks* landmarks)
362 {
363   mLandmarks = landmarks;
364   if (landmarks)
365     {
366
367       if (!mCross)
368         mCross = vtkCursor3D::New();
369       mCross->SetFocalPoint(0.0,0.0,0.0);
370       mCross->SetModelBounds(-10,10,-10,10,-10,10);
371       mCross->AllOff();
372       mCross->AxesOn();
373
374       if (!mLandGlyph)
375         mLandGlyph = vtkGlyph3D::New();
376       mLandGlyph->SetSource(mCross->GetOutput());
377       mLandGlyph->SetInput(landmarks->GetOutput());
378       //mLandGlyph->SetIndexModeToScalar();
379       mLandGlyph->SetRange(0,1);
380       mLandGlyph->ScalingOff();
381
382       mLandGlyph->SetColorModeToColorByScalar();
383
384       if (!mClipBox)
385         mClipBox = vtkBox::New();
386       if (!mLandClipper)
387         mLandClipper = vtkClipPolyData::New();
388       mLandClipper->InsideOutOn();
389       mLandClipper->SetInput(mLandGlyph->GetOutput());
390       mLandClipper->SetClipFunction(mClipBox);
391
392       if (!mLandMapper)
393         mLandMapper = vtkPolyDataMapper::New();
394       mLandMapper->SetInputConnection(mLandClipper->GetOutputPort());
395       //mLandMapper->ScalarVisibilityOff();
396
397       if (!mLandActor)
398         mLandActor = vtkActor::New();
399       mLandActor->SetMapper(mLandMapper);
400       mLandActor->GetProperty()->SetColor(255,10,212);
401       mLandActor->SetPickable(0);
402       mLandActor->SetVisibility(true);
403       this->UpdateDisplayExtent();
404       this->GetRenderer()->AddActor(mLandActor);
405     }
406 }
407
408 //FIXME: this function leaks memory, we should fix it someday :)
409 void vvSlicer::RemoveActor(const std::string& actor_type, int overlay_index)
410 {
411   if (actor_type == "vector")
412     {
413       Renderer->RemoveActor(mVFActor);
414       mGlyphFilter=NULL;
415       mVF = NULL;
416       mArrow = NULL;
417       mAAFilter=NULL;
418       mVOIFilter = NULL;
419       mVFMapper = NULL;
420       mVFActor = NULL;
421     }
422   if (actor_type == "overlay")
423     {
424       Renderer->RemoveActor(mOverlayActor);
425       mOverlay = NULL;
426       mOverlayActor = NULL;
427       mOverlayMapper = NULL;
428     }
429   if (actor_type == "fusion")
430     {
431       Renderer->RemoveActor(mFusionActor);
432       mFusion = NULL;
433       mFusionActor = NULL;
434       mFusionMapper = NULL;
435     }
436   if (actor_type == "contour")
437     {
438       Renderer->RemoveActor(this->mSurfaceCutActors[overlay_index]->GetActor());
439       mSurfaceCutActors.erase(mSurfaceCutActors.begin()+overlay_index);
440     }
441 }
442
443 void vvSlicer::SetVFSubSampling(int sub)
444 {
445   if (mVOIFilter)
446     {
447       mVOIFilter->SetSampleRate(mSubSampling,mSubSampling,mSubSampling);
448       mSubSampling = sub;
449     }
450   UpdateDisplayExtent();
451   Render();
452 }
453
454 void vvSlicer::SetVFScale(int scale)
455 {
456   mScale = scale;
457   if (mArrow)
458     mArrow->SetScale(mScale);
459   UpdateDisplayExtent();
460   Render();
461 }
462
463 void vvSlicer::SetVFLog(int log)
464 {
465   mVFLog = log;
466   if (mGlyphFilter)
467     {
468       mGlyphFilter->SetUseLog(mVFLog);
469       mGlyphFilter->Modified();
470     }
471   UpdateDisplayExtent();
472   Render();
473 }
474
475 void vvSlicer::SetTSlice(int t)
476 {
477   if (t < 0)
478     t = 0;
479   else if ((unsigned int)t >= mImage->GetVTKImages().size())
480     t = mImage->GetVTKImages().size() -1;
481   mCurrentTSlice = t;
482   this->SetInput(mImage->GetVTKImages()[t]);
483   if (mVF && mVFActor->GetVisibility())
484     {
485       if (mVF->GetVTKImages().size() > (unsigned int)mCurrentTSlice)
486         mVOIFilter->SetInput(mVF->GetVTKImages()[mCurrentTSlice]);
487     }
488   if (mOverlay && mOverlayActor->GetVisibility())
489     {
490       if (mOverlay->GetVTKImages().size() > (unsigned int)mCurrentTSlice)
491         mOverlayMapper->SetInput(mOverlay->GetVTKImages()[mCurrentTSlice]);
492     }
493   if (mFusion && mFusionActor->GetVisibility())
494     {
495       if (mFusion->GetVTKImages().size() > (unsigned int)mCurrentTSlice)
496         mFusionMapper->SetInput(mFusion->GetVTKImages()[mCurrentTSlice]);
497     }
498   if (mSurfaceCutActors.size() > 0)
499     for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
500          i!=mSurfaceCutActors.end();i++)
501       (*i)->SetTimeSlice(mCurrentTSlice);
502   UpdateDisplayExtent();
503 }
504
505 int vvSlicer::GetTSlice()
506 {
507   return mCurrentTSlice;
508 }
509
510 void vvSlicer::SetSliceOrientation(int orientation)
511 {
512   //if 2D image, force to watch in Axial View
513   int extent[6];
514   this->GetInput()->GetWholeExtent(extent);
515   if (extent[5]-extent[4] <= 2)
516     orientation=2;
517
518   if (orientation < vtkImageViewer2::SLICE_ORIENTATION_YZ ||
519       orientation > vtkImageViewer2::SLICE_ORIENTATION_XY)
520     {
521       vtkErrorMacro("Error - invalid slice orientation " << orientation);
522       return;
523     }
524
525   this->SliceOrientation = orientation;
526     
527   // Update the viewer
528   int *range = this->GetSliceRange();
529   if (range)
530     this->Slice = static_cast<int>((range[0] + range[1]) * 0.5);
531
532   this->UpdateOrientation();
533   this->UpdateDisplayExtent();
534
535   if (this->Renderer && this->GetInput())
536     {
537       double scale = this->Renderer->GetActiveCamera()->GetParallelScale();
538       this->Renderer->ResetCamera();
539       this->Renderer->GetActiveCamera()->SetParallelScale(scale);
540     }
541
542   SetContourSlice();
543 }
544
545 //----------------------------------------------------------------------------
546 void vvSlicer::UpdateDisplayExtent()
547 {
548   vtkImageData *input = this->GetInput();
549   if (!input || !this->ImageActor)
550     {
551       return;
552     }
553   input->UpdateInformation();
554   int *w_ext = input->GetWholeExtent();
555
556   switch (this->SliceOrientation)
557     {
558     case vtkImageViewer2::SLICE_ORIENTATION_XY:
559       this->ImageActor->SetDisplayExtent(
560                                          w_ext[0], w_ext[1], w_ext[2], w_ext[3], this->Slice, this->Slice);
561       if (mVF && mVFActor->GetVisibility())
562         {
563           int vfExtent[6];
564           ComputeVFDisplayedExtent(w_ext[0], w_ext[1], w_ext[2], w_ext[3], this->Slice, this->Slice,vfExtent);
565           mVOIFilter->SetVOI(vfExtent);
566           mGlyphFilter->SetOrientation(1,1,0);
567           mVFMapper->Update();
568           // put the vector field between the image and the camera
569           if (Renderer->GetActiveCamera()->GetPosition()[2] > this->Slice)
570             mVFActor->SetPosition(0,0,ImageActor->GetBounds()[5]+2);
571           else
572             mVFActor->SetPosition(0,0,ImageActor->GetBounds()[4]-2);
573         }
574       if (mOverlay && mOverlayActor->GetVisibility())
575         {
576           int overExtent[6];
577           ComputeOverlayDisplayedExtent(w_ext[0], w_ext[1], w_ext[2], w_ext[3], this->Slice, this->Slice,overExtent);
578           mOverlayActor->SetDisplayExtent(overExtent);
579           if (Renderer->GetActiveCamera()->GetPosition()[2] > this->Slice)
580             mOverlayActor->SetPosition(0,0,1);
581           else
582             mOverlayActor->SetPosition(0,0,-1);
583         }
584       if (mFusion && mFusionActor->GetVisibility())
585         {
586           int fusExtent[6];
587           ComputeFusionDisplayedExtent(w_ext[0], w_ext[1], w_ext[2], w_ext[3], this->Slice, this->Slice,fusExtent);
588           mFusionActor->SetDisplayExtent(fusExtent);
589           if (Renderer->GetActiveCamera()->GetPosition()[2] > this->Slice)
590             mFusionActor->SetPosition(0,0,1.5);
591           else
592             mFusionActor->SetPosition(0,0,-1.5);
593         }
594       if (mLandActor)
595         {
596           if (mClipBox)
597             {
598               double bounds [6];
599               bounds[0] = ImageActor->GetBounds()[0];
600               bounds[1] = ImageActor->GetBounds()[1];
601               bounds[2] = ImageActor->GetBounds()[2];
602               bounds[3] = ImageActor->GetBounds()[3];
603               bounds[4] = ImageActor->GetBounds()[4]-(0.9/this->GetInput()->GetSpacing()[2]);
604               bounds[5] = ImageActor->GetBounds()[5]+(0.9/this->GetInput()->GetSpacing()[2]);
605               mClipBox->SetBounds(bounds);
606               UpdateLandmarks();
607             }
608           if (Renderer->GetActiveCamera()->GetPosition()[2] > this->Slice)
609             mLandActor->SetPosition(0,0,1.5);
610           else
611             mLandActor->SetPosition(0,0,-1.5);
612         }
613       break;
614
615     case vtkImageViewer2::SLICE_ORIENTATION_XZ:
616       this->ImageActor->SetDisplayExtent(
617                                          w_ext[0], w_ext[1], this->Slice, this->Slice, w_ext[4], w_ext[5]);
618       if (mVF && mVFActor->GetVisibility())
619         {
620           int vfExtent[6];
621           ComputeVFDisplayedExtent(w_ext[0], w_ext[1], this->Slice, this->Slice, w_ext[4], w_ext[5],vfExtent);
622           mVOIFilter->SetVOI(vfExtent);
623           mGlyphFilter->SetOrientation(1,0,1);
624           mVFMapper->Update();
625           // put the vector field between the image aSpacingnd the camera
626           if (Renderer->GetActiveCamera()->GetPosition()[1] > this->Slice)
627             mVFActor->SetPosition(0,ImageActor->GetBounds()[3]+2,0);
628           else
629             mVFActor->SetPosition(0,ImageActor->GetBounds()[2]-2,0);
630         }
631       if (mOverlay && mOverlayActor->GetVisibility())
632         {
633           int overExtent[6];
634           ComputeOverlayDisplayedExtent(w_ext[0], w_ext[1], this->Slice, this->Slice, w_ext[4], w_ext[5],overExtent);
635           mOverlayActor->SetDisplayExtent(overExtent);
636           if (Renderer->GetActiveCamera()->GetPosition()[1] > this->Slice)
637             mOverlayActor->SetPosition(0,1,0);
638           else
639             mOverlayActor->SetPosition(0,-1,0);
640         }
641       if (mFusion && mFusionActor->GetVisibility())
642         {
643           int fusExtent[6];
644           ComputeFusionDisplayedExtent(w_ext[0], w_ext[1], this->Slice, this->Slice, w_ext[4], w_ext[5],fusExtent);
645           mFusionActor->SetDisplayExtent(fusExtent);
646           if (Renderer->GetActiveCamera()->GetPosition()[1] > this->Slice)
647             mFusionActor->SetPosition(0,1.5,0);
648           else
649             mFusionActor->SetPosition(0,-1.5,0);
650         }
651       if (mLandActor)
652         {
653           if (mClipBox)
654             {
655               double bounds [6];
656               bounds[0] = ImageActor->GetBounds()[0];
657               bounds[1] = ImageActor->GetBounds()[1];
658               bounds[2] = ImageActor->GetBounds()[2]-(0.5/this->GetInput()->GetSpacing()[1]);
659               bounds[3] = ImageActor->GetBounds()[3]+(0.5/this->GetInput()->GetSpacing()[1]);
660               bounds[4] = ImageActor->GetBounds()[4];
661               bounds[5] = ImageActor->GetBounds()[5];
662               mClipBox->SetBounds(bounds);
663               UpdateLandmarks();
664             }
665           if (Renderer->GetActiveCamera()->GetPosition()[1] > this->Slice)
666             mLandActor->SetPosition(0,1.5,0);
667           else
668             mLandActor->SetPosition(0,-1.5,0);
669         }
670       break;
671
672     case vtkImageViewer2::SLICE_ORIENTATION_YZ:
673       this->ImageActor->SetDisplayExtent(
674                                          this->Slice, this->Slice, w_ext[2], w_ext[3], w_ext[4], w_ext[5]);
675       if (mVF && mVFActor->GetVisibility())
676         {
677           int vfExtent[6];
678           ComputeVFDisplayedExtent(this->Slice, this->Slice, w_ext[2], w_ext[3], w_ext[4], w_ext[5],vfExtent);
679           mVOIFilter->SetVOI(vfExtent);
680           mGlyphFilter->SetOrientation(0,1,1);
681           mVFMapper->Update();
682           // put the vector field between the image and the camera
683           if (Renderer->GetActiveCamera()->GetPosition()[0] > this->Slice)
684             mVFActor->SetPosition(ImageActor->GetBounds()[1]+2,0,0);
685           else
686             mVFActor->SetPosition(ImageActor->GetBounds()[0]-2,0,0);
687         }
688       if (mOverlay && mOverlayActor->GetVisibility())
689         {
690           int overExtent[6];
691           ComputeOverlayDisplayedExtent(this->Slice, this->Slice, w_ext[2], w_ext[3], w_ext[4], w_ext[5],overExtent);
692           mOverlayActor->SetDisplayExtent(overExtent);
693           if (Renderer->GetActiveCamera()->GetPosition()[0] > this->Slice)
694             mOverlayActor->SetPosition(1,0,0);
695           else
696             mOverlayActor->SetPosition(-1,0,0);
697         }
698       if (mFusion && mFusionActor->GetVisibility())
699         {
700           int fusExtent[6];
701           ComputeFusionDisplayedExtent(this->Slice, this->Slice, w_ext[2], w_ext[3], w_ext[4], w_ext[5],fusExtent);
702           mFusionActor->SetDisplayExtent(fusExtent);
703           if (Renderer->GetActiveCamera()->GetPosition()[0] > this->Slice)
704             mFusionActor->SetPosition(1.5,0,0);
705           else
706             mFusionActor->SetPosition(-1.5,0,0);
707         }
708       if (mLandActor)
709         {
710           if (mClipBox)
711             {
712               double bounds [6];
713               bounds[0] = ImageActor->GetBounds()[0]-(0.5/this->GetInput()->GetSpacing()[0]);
714               bounds[1] = ImageActor->GetBounds()[1]+(0.5/this->GetInput()->GetSpacing()[0]);
715               bounds[2] = ImageActor->GetBounds()[2];
716               bounds[3] = ImageActor->GetBounds()[3];
717               bounds[4] = ImageActor->GetBounds()[4];
718               bounds[5] = ImageActor->GetBounds()[5];
719               mClipBox->SetBounds(bounds);
720               UpdateLandmarks();
721             }
722           if (Renderer->GetActiveCamera()->GetPosition()[0] > this->Slice)
723             mLandActor->SetPosition(1.5,0,0);
724           else
725             mLandActor->SetPosition(-1.5,0,0);
726         }
727       break;
728     }
729
730   // Figure out the correct clipping range
731
732   if (this->Renderer)
733     {
734       if (this->InteractorStyle &&
735           this->InteractorStyle->GetAutoAdjustCameraClippingRange())
736         {
737           this->Renderer->ResetCameraClippingRange();
738         }
739       else
740         {
741           vtkCamera *cam = this->Renderer->GetActiveCamera();
742           if (cam)
743             {
744               double bounds[6];
745               this->ImageActor->GetBounds(bounds);
746               double spos = (double)bounds[this->SliceOrientation * 2];
747               double cpos = (double)cam->GetPosition()[this->SliceOrientation];
748               double range = fabs(spos - cpos);
749               double *spacing = input->GetSpacing();
750               double avg_spacing =
751                 ((double)spacing[0] + (double)spacing[1] + (double)spacing[2]) / 3.0;
752               cam->SetClippingRange(
753                                     range - avg_spacing * 3.0, range + avg_spacing * 3.0);
754             }
755         }
756     }
757 }
758
759 void vvSlicer::ComputeVFDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int vfExtent[6])
760 {
761   vtkImageData* image=this->GetInput();
762   vfExtent[0] = (( image->GetOrigin()[0] + x1*image->GetSpacing()[0] ) - mVF->GetOrigin()[0]) /
763     mVF->GetSpacing()[0];
764   vfExtent[1] = (( image->GetOrigin()[0] + x2*image->GetSpacing()[0] ) - mVF->GetOrigin()[0]) /
765     mVF->GetSpacing()[0];
766   vfExtent[2] = (( image->GetOrigin()[1] + y1*image->GetSpacing()[1] ) - mVF->GetOrigin()[1]) /
767     mVF->GetSpacing()[1];
768   vfExtent[3] = (( image->GetOrigin()[1] + y2*image->GetSpacing()[1] ) - mVF->GetOrigin()[1]) /
769     mVF->GetSpacing()[1];
770   vfExtent[4] = (( image->GetOrigin()[2] + z1*image->GetSpacing()[2] ) - mVF->GetOrigin()[2]) /
771     mVF->GetSpacing()[2];
772   vfExtent[5] = (( image->GetOrigin()[2] + z2*image->GetSpacing()[2] ) - mVF->GetOrigin()[2]) /
773     mVF->GetSpacing()[2];
774
775   ClipDisplayedExtent(vfExtent,mVOIFilter->GetInput()->GetWholeExtent());
776 }
777
778 void vvSlicer::ComputeOverlayDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int overExtent[6])
779 {
780   vtkImageData* image=this->GetInput();
781   overExtent[0] = (( image->GetOrigin()[0] + x1*image->GetSpacing()[0] ) - mOverlay->GetOrigin()[0]) /
782     mOverlay->GetSpacing()[0];
783   overExtent[1] = (( image->GetOrigin()[0] + x2*image->GetSpacing()[0] ) - mOverlay->GetOrigin()[0]) /
784     mOverlay->GetSpacing()[0];
785   overExtent[2] = (( image->GetOrigin()[1] + y1*image->GetSpacing()[1] ) - mOverlay->GetOrigin()[1]) /
786     mOverlay->GetSpacing()[1];
787   overExtent[3] = (( image->GetOrigin()[1] + y2*image->GetSpacing()[1] ) - mOverlay->GetOrigin()[1]) /
788     mOverlay->GetSpacing()[1];
789   overExtent[4] = (( image->GetOrigin()[2] + z1*image->GetSpacing()[2] ) - mOverlay->GetOrigin()[2]) /
790     mOverlay->GetSpacing()[2];
791   overExtent[5] = (( image->GetOrigin()[2] + z2*image->GetSpacing()[2] ) - mOverlay->GetOrigin()[2]) /
792     mOverlay->GetSpacing()[2];
793   ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetWholeExtent());
794 }
795
796 void vvSlicer::ComputeFusionDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int fusExtent[6])
797 {
798   vtkImageData* image=this->GetInput();
799   fusExtent[0] = (( image->GetOrigin()[0] + x1*image->GetSpacing()[0] ) - mFusion->GetOrigin()[0]) /
800     mFusion->GetSpacing()[0];
801   fusExtent[1] = (( image->GetOrigin()[0] + x2*image->GetSpacing()[0] ) - mFusion->GetOrigin()[0]) /
802     mFusion->GetSpacing()[0];
803   fusExtent[2] = (( image->GetOrigin()[1] + y1*image->GetSpacing()[1] ) - mFusion->GetOrigin()[1]) /
804     mFusion->GetSpacing()[1];
805   fusExtent[3] = (( image->GetOrigin()[1] + y2*image->GetSpacing()[1] ) - mFusion->GetOrigin()[1]) /
806     mFusion->GetSpacing()[1];
807   fusExtent[4] = (( image->GetOrigin()[2] + z1*image->GetSpacing()[2] ) - mFusion->GetOrigin()[2]) /
808     mFusion->GetSpacing()[2];
809   fusExtent[5] = (( image->GetOrigin()[2] + z2*image->GetSpacing()[2] ) - mFusion->GetOrigin()[2]) /
810     mFusion->GetSpacing()[2];
811   ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetWholeExtent());
812 }
813
814 void vvSlicer::ClipDisplayedExtent(int extent[6], int refExtent[6])
815 {
816   bool out = false;
817   int maxBound = 6;
818
819   //2D overlay on 3D image specific case
820   if (refExtent[4] == refExtent[5])
821     {
822       maxBound = 4;
823       extent[4] = refExtent[4];
824       extent[5] = refExtent[5];
825     }
826
827   for (int i = 0; i < maxBound; i = i+2)
828     {
829       //if we are totally outside the image
830       if ( extent[i] > refExtent[i+1] || extent[i+1] < refExtent[i] )
831         {
832           out = true;
833           break;
834         }
835       //crop to the limit of the image
836       extent[i] = (extent[i] > refExtent[i]) ? extent[i] : refExtent[i];
837       extent[i] = (extent[i] < refExtent[i+1]) ? extent[i] : refExtent[i+1];
838       extent[i+1] = (extent[i+1] > refExtent[i]) ? extent[i+1] : refExtent[i];
839       extent[i+1] = (extent[i+1] < refExtent[i+1]) ? extent[i+1] : refExtent[i+1];
840     }
841   if (out)
842     for (int i = 0; i < maxBound; i = i+2)
843       {
844         extent[i] = refExtent[i];
845         extent[i+1] = refExtent[i];
846       }
847 }
848
849 void vvSlicer::UpdateOrientation()
850 {
851   // Set the camera position
852   vtkCamera *cam = this->Renderer ? this->Renderer->GetActiveCamera() : NULL;
853   if (cam)
854     {
855       switch (this->SliceOrientation)
856         {
857         case vtkImageViewer2::SLICE_ORIENTATION_XY:
858           cam->SetFocalPoint(0,0,0);
859           cam->SetPosition(0,0,-1); // -1 if medical ?
860           cam->SetViewUp(0,-1,0);
861           break;
862
863         case vtkImageViewer2::SLICE_ORIENTATION_XZ:
864           cam->SetFocalPoint(0,0,0);
865           cam->SetPosition(0,-1,0); // 1 if medical ?
866           cam->SetViewUp(0,0,1);
867           break;
868
869         case vtkImageViewer2::SLICE_ORIENTATION_YZ:
870           cam->SetFocalPoint(0,0,0);
871           cam->SetPosition(-1,0,0); // -1 if medical ?
872           cam->SetViewUp(0,0,1);
873           break;
874         }
875     }
876 }
877
878 void vvSlicer::SetOpacity(double s)
879 {
880   this->GetImageActor()->SetOpacity(s);
881 }
882
883 void vvSlicer::SetRenderWindow(int orientation, vtkRenderWindow * rw)
884 {
885   this->Superclass::SetRenderWindow(rw);
886   this->SetupInteractor(rw->GetInteractor());
887   ca->SetImageActor(this->GetImageActor());
888   ca->SetWindowLevel(this->GetWindowLevel());
889   ca->SetText(2, "<slice>");
890   ca->SetText(3, "<window>\n<level>");
891
892   double bounds[6];
893   double max = 65000;
894
895   bounds[0] = -max;
896   bounds[1] = max;
897   bounds[2] = -max;
898   bounds[3] = max;
899   bounds[4] = -max;
900   bounds[5] = max;
901
902   crossCursor->SetModelBounds(bounds);
903   this->GetRenderer()->AddActor(pdmA);
904   this->GetRenderer()->AddActor(ca);
905   this->GetRenderer()->ResetCamera();
906
907   //this is just a mapping between the labeling of the orientations presented to the user and
908   //the one used by vtk
909   SetSliceOrientation(2-(orientation%3));
910   ResetCamera();
911 }
912
913 void vvSlicer::ResetCamera()
914 {
915   if (this->GetInput())
916     {
917       double* input_bounds=this->GetInput()->GetBounds();
918       double bmax=input_bounds[1]-input_bounds[0];
919       if (bmax < input_bounds[3]-input_bounds[2]) bmax=input_bounds[3]-input_bounds[2];
920       if (bmax < input_bounds[5]-input_bounds[4]) bmax=input_bounds[5]-input_bounds[4];
921       this->GetRenderer()->ResetCamera();
922       this->GetRenderer()->GetActiveCamera()->SetParallelScale(bmax/2);
923     }
924 }
925
926 void vvSlicer::SetDisplayMode(bool i)
927 {
928   this->GetImageActor()->SetVisibility(i);
929   this->GetAnnotation()->SetVisibility(i);
930   this->GetRenderer()->SetDraw(i);
931   if (mLandActor)
932     mLandActor->SetVisibility(i);
933   pdmA->SetVisibility(i);
934   if (i)
935     UpdateDisplayExtent();
936 }
937 //----------------------------------------------------------------------------
938
939
940 //----------------------------------------------------------------------------
941 void vvSlicer::FlipHorizontalView()
942 {
943   vtkCamera *cam = this->Renderer ? this->Renderer->GetActiveCamera() : NULL;
944   if (cam)
945     {
946       double *position = cam->GetPosition();
947       switch (this->SliceOrientation)
948         {
949         case vtkImageViewer2::SLICE_ORIENTATION_XY:
950           cam->SetPosition(position[0],position[1],-position[2]);
951           break;
952
953         case vtkImageViewer2::SLICE_ORIENTATION_XZ:
954           cam->SetPosition(position[0],-position[1],position[2]);
955           break;
956
957         case vtkImageViewer2::SLICE_ORIENTATION_YZ:
958           cam->SetPosition(-position[0],position[1],position[2]);
959           break;
960         }
961       this->Renderer->ResetCameraClippingRange();
962       this->UpdateDisplayExtent();
963     }
964 }
965 //----------------------------------------------------------------------------
966
967
968 //----------------------------------------------------------------------------
969 void vvSlicer::FlipVerticalView()
970 {
971   vtkCamera *cam = this->Renderer ? this->Renderer->GetActiveCamera() : NULL;
972   if (cam)
973     {
974       FlipHorizontalView();
975       double *viewup = cam->GetViewUp();
976       cam->SetViewUp(-viewup[0],-viewup[1],-viewup[2]);
977       this->UpdateDisplayExtent();
978     }
979 }
980 //----------------------------------------------------------------------------
981
982
983 //----------------------------------------------------------------------------
984 void vvSlicer::SetColorWindow(double window)
985 {
986   vtkLookupTable* LUT = static_cast<vtkLookupTable*>(this->GetWindowLevel()->GetLookupTable());
987   if ( LUT )
988     {
989       double level = this->GetWindowLevel()->GetLevel();
990       LUT->SetTableRange(level-fabs(window)/4,level+fabs(window)/4);
991       LUT->Build();
992     }
993   this->vtkImageViewer2::SetColorWindow(window);
994 }
995 //----------------------------------------------------------------------------
996
997
998 //----------------------------------------------------------------------------
999 void vvSlicer::SetColorLevel(double level)
1000 {
1001   vtkLookupTable* LUT = static_cast<vtkLookupTable*>(this->GetWindowLevel()->GetLookupTable());
1002   if ( LUT )
1003     {
1004       double window = this->GetWindowLevel()->GetWindow();
1005       LUT->SetTableRange(level-fabs(window)/4,level+fabs(window)/4);
1006       LUT->Build();
1007     }
1008   this->vtkImageViewer2::SetColorLevel(level);
1009 }
1010 //----------------------------------------------------------------------------
1011
1012
1013 //----------------------------------------------------------------------------
1014 void vvSlicer::Render()
1015 {
1016   if (this->GetWindowLevel()->GetLookupTable() && !this->mOverlay && !this->mFusion)
1017     {
1018       legend->SetLookupTable(this->GetWindowLevel()->GetLookupTable());
1019       legend->SetVisibility(1);
1020     }
1021   else legend->SetVisibility(0);
1022
1023   if (ca->GetVisibility())
1024     {
1025       std::string worldPos = "";
1026       std::stringstream world1;
1027       std::stringstream world2;
1028       std::stringstream world3;
1029       world1 << (int)mCurrent[0];
1030       world2 << (int)mCurrent[1];
1031       world3 << (int)mCurrent[2];
1032       double X = (mCurrent[0] - this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
1033       double Y = (mCurrent[1] - this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
1034       double Z = (mCurrent[2] - this->GetInput()->GetOrigin()[2])/this->GetInput()->GetSpacing()[2];
1035
1036       if (pdmA->GetVisibility())
1037         {
1038           double x = mCursor[0];
1039           double y = mCursor[1];
1040           double z = mCursor[2];
1041           double xCursor = (x - this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
1042           double yCursor = (y - this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
1043           double zCursor = (z - this->GetInput()->GetOrigin()[2])/this->GetInput()->GetSpacing()[2];
1044
1045           if (xCursor >= this->GetImageActor()->GetDisplayExtent()[0] &&
1046               xCursor < this->GetImageActor()->GetDisplayExtent()[1]+1 &&
1047               yCursor >= this->GetImageActor()->GetDisplayExtent()[2] &&
1048               yCursor < this->GetImageActor()->GetDisplayExtent()[3]+1 &&
1049               zCursor >= this->GetImageActor()->GetDisplayExtent()[4] &&
1050               zCursor < this->GetImageActor()->GetDisplayExtent()[5]+1 )
1051             {
1052               vtkRenderer * renderer = this->Renderer;
1053
1054               renderer->WorldToView(x,y,z);
1055               renderer->ViewToNormalizedViewport(x,y,z);
1056               renderer->NormalizedViewportToViewport(x,y);
1057               renderer->ViewportToNormalizedDisplay(x,y);
1058               renderer->NormalizedDisplayToDisplay(x,y);
1059               crossCursor->SetFocalPoint(x,y,z);
1060             }
1061           else
1062             crossCursor->SetFocalPoint(-1,-1,z);
1063         }
1064
1065       if (X >= this->GetInput()->GetWholeExtent()[0] &&
1066           X <= this->GetInput()->GetWholeExtent()[1] &&
1067           Y >= this->GetInput()->GetWholeExtent()[2] &&
1068           Y <= this->GetInput()->GetWholeExtent()[3] &&
1069           Z >= this->GetInput()->GetWholeExtent()[4] &&
1070           Z <= this->GetInput()->GetWholeExtent()[5])
1071         {
1072           std::stringstream pixel1;
1073           std::stringstream pixel2;
1074           std::stringstream pixel3;
1075           std::stringstream temps;
1076           pixel1 << (int)X;
1077           pixel2 << (int)Y;
1078           pixel3 << (int)Z;
1079           temps << mCurrentTSlice;
1080           double value = this->GetInput()->GetScalarComponentAsDouble(
1081                                                                       (int)X,
1082                                                                       (int)Y,
1083                                                                       (int)Z,0);
1084
1085           std::stringstream val;
1086           val << value;
1087           worldPos += "data value : " + val.str();
1088           worldPos += "\n mm : " + world1.str() + " " + world2.str() + " " + world3.str() + " " + temps.str();
1089           worldPos += "\n pixel : " + pixel1.str() + " " + pixel2.str() + " " + pixel3.str() + " " + temps.str();
1090         }
1091       ca->SetText(1,worldPos.c_str());
1092     }
1093   if (mOverlay && mOverlayActor->GetVisibility())
1094     {
1095       mOverlayMapper->SetWindow(this->GetColorWindow());
1096       mOverlayMapper->SetLevel(this->GetColorLevel());
1097       mOverlayMapper->Update();
1098     }
1099   if (mLandMapper)
1100     UpdateLandmarks();
1101   //this->Superclass::Render();
1102   this->GetRenderWindow()->Render();
1103 }
1104 //----------------------------------------------------------------------------
1105
1106
1107 //----------------------------------------------------------------------------
1108 void vvSlicer::UpdateCursorPosition()
1109 {
1110   if (this->GetImageActor()->GetVisibility())
1111     {
1112       pdmA->SetVisibility(true);
1113       mCursor[0] = mCurrent[0];
1114       mCursor[1] = mCurrent[1];
1115       mCursor[2] = mCurrent[2];
1116       mCursor[3] = mCurrentTSlice;
1117     }
1118 }
1119 //----------------------------------------------------------------------------
1120
1121 //----------------------------------------------------------------------------
1122 void vvSlicer::UpdateLandmarks()
1123 {
1124   vtkPolyData *pd = static_cast<vtkPolyData*>(mLandClipper->GetInput());
1125   if (pd->GetPoints())
1126     {
1127       mLandGlyph->SetRange(0,1);
1128       mLandGlyph->Modified();
1129       mLandGlyph->Update();
1130
1131       mClipBox->Modified();
1132       mLandClipper->Update();
1133       mLandMapper->Update();
1134     }
1135
1136 }
1137 //----------------------------------------------------------------------------
1138
1139
1140 //----------------------------------------------------------------------------
1141 void vvSlicer::SetSlice(int slice)
1142 {
1143   int *range = this->GetSliceRange();
1144   if (range)
1145     {
1146       if (slice < range[0])
1147         {
1148           slice = range[0];
1149         }
1150       else if (slice > range[1])
1151         {
1152           slice = range[1];
1153         }
1154     }
1155
1156   if (this->Slice == slice)
1157     {
1158       return;
1159     }
1160
1161   this->Slice = slice;
1162   SetContourSlice();
1163   this->Modified();
1164   this->UpdateDisplayExtent();
1165   this->Render();
1166 }
1167 //----------------------------------------------------------------------------
1168
1169
1170 //----------------------------------------------------------------------------
1171 void vvSlicer::SetContourSlice()
1172 {
1173   if (mSurfaceCutActors.size() > 0)
1174     for (std::vector<vvMeshActor*>::iterator i=mSurfaceCutActors.begin();
1175          i!=mSurfaceCutActors.end();i++)
1176       (*i)->SetCutSlice((this->Slice)*this->GetImage()->GetSpacing()[this->SliceOrientation]+
1177                         this->GetImage()->GetOrigin()[this->SliceOrientation]);
1178 }
1179 //----------------------------------------------------------------------------
1180
1181
1182 //----------------------------------------------------------------------------
1183 void vvSlicer::ForceUpdateDisplayExtent()
1184 {
1185   this->UpdateDisplayExtent();
1186 }
1187 //----------------------------------------------------------------------------
1188
1189
1190 //----------------------------------------------------------------------------
1191 int* vvSlicer::GetDisplayExtent()
1192 {
1193   return this->GetImageActor()->GetDisplayExtent();
1194 }
1195 //----------------------------------------------------------------------------
1196
1197
1198 //----------------------------------------------------------------------------
1199 void vvSlicer::PrintSelf(ostream& os, vtkIndent indent)
1200 {
1201   this->Superclass::PrintSelf(os, indent);
1202 }
1203 //----------------------------------------------------------------------------