]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx
functionalities of RC and MIP working in paralell
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / vtkClipping3DDataViewer.cxx
1
2 #include "vtkClipping3DDataViewer.h"
3 #include "vtkDataSetReader.h"
4 #include "vtkProperty.h"
5
6 vtkClipping3DDataViewer::vtkClipping3DDataViewer()
7 {
8         int i;
9         for (i=0; i<VTKMPRDATA_MAXTISSUE; i++){
10                 _visibleTissue[i]               = false;
11                 _representationType[i]  = true;
12         }
13         _visibleVolume=false;
14         _isRayCasting=true;
15     _isMIP=false;
16         _interpolation=false;
17         _shade=false;
18
19     _volumeMapper = vtkVolumeRayCastMapper::New();
20     _newvol = vtkVolume::New();
21     _volumeProperty = vtkVolumeProperty::New();
22 }
23 //-------------------------------------------------------------------
24 vtkClipping3DDataViewer::~vtkClipping3DDataViewer()
25 {
26         int i;
27         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
28                 _mCubes[i]->Delete();
29                 _tissueStripper[i]->Delete();
30                 _tissueMapper[i]->Delete();
31                 _tissuePlanes[i]->Delete();
32                 _tissueClipper[i]->Delete();
33         }
34         _outlineData->Delete();
35         _mapOutline->Delete();
36         _outline->Delete();
37         // Volume
38         _tfun->Delete();
39         _ctfun->Delete();
40         _compositeFunction->Delete();
41         _volumeMapper->Delete();
42         _volumeProperty->Delete();
43         _newvol->Delete();
44         _volumePlanes->Delete();
45
46         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
47                 _tissue[i]-> Delete();
48                 _observerS[i]-> Delete();
49         }
50         _observerV-> Delete();
51 }
52 //-------------------------------------------------------------------
53 vtkActor* vtkClipping3DDataViewer::GetOutlineActor()
54 {
55         return _outline;
56 }
57 //-------------------------------------------------------------------
58 vtkClipPolyData* vtkClipping3DDataViewer::GetTissueClipper(int id)
59 {
60         return this->_tissueClipper[id];
61 }
62 //-------------------------------------------------------------------
63 vtkPolyDataMapper* vtkClipping3DDataViewer::GetTissueMapper(int id)
64 {
65         return _tissueMapper[id];
66 }
67 //-------------------------------------------------------------------
68 vtkPlanes* vtkClipping3DDataViewer::GetTissuePlanes(int id)
69 {
70         return _tissuePlanes[id];
71 }
72 //-------------------------------------------------------------------
73 vtkStripper* vtkClipping3DDataViewer::GetTissueStripper(int id)
74 {
75         return _tissueStripper[id];
76 }
77 //-------------------------------------------------------------------
78 void vtkClipping3DDataViewer::Refresh()
79 {
80 //      _volumeMapper->SetClippingPlanes(_volumePlanes);
81
82 //      this->_volumeMapper->Update();
83 //      this->_newvol->Update();
84
85 //      _newvol->VisibilityOn();
86
87
88 // _volumeMapper = vtkVolumeRayCastMapper::New();
89 //      _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() );
90 //      _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
91 //      _volumeMapper->SetClippingPlanes( _volumePlanes );
92 //      _newvol->SetMapper(_volumeMapper );
93
94
95 }
96 //-------------------------------------------------------------------
97 void vtkClipping3DDataViewer::RefreshSurface()
98 {
99         int i;
100         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
101         {
102                 SetIsovalue(i, (int) (GetIsovalue(i)+1) );
103 //              this->GetMCubes(i)->Update();
104         }
105 }
106 //-------------------------------------------------------------------
107 void vtkClipping3DDataViewer::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
108 {
109         _vtkmprbasedata=vtkmprbasedata;
110 }
111 //-------------------------------------------------------------------
112 vtkMPRBaseData* vtkClipping3DDataViewer::GetVtkMPRBaseData()
113 {
114         return _vtkmprbasedata;
115 }
116
117
118 //-------------------------------------------------------------------
119 void vtkClipping3DDataViewer::SetVisibleTissue(int idTissue, bool visible)
120 {
121         _visibleTissue[idTissue]=visible;
122 }
123 //-------------------------------------------------------------------
124 bool vtkClipping3DDataViewer::GetVisibleTissue(int idTissue){
125         return _visibleTissue[idTissue];
126 }
127 //-------------------------------------------------------------------
128 void vtkClipping3DDataViewer::SetRepresentationType(int idTissue, bool representationType)
129 {
130         _representationType[idTissue]=representationType;
131 }
132 //-------------------------------------------------------------------
133 bool vtkClipping3DDataViewer::GetRepresentationType(int idTissue)
134 {
135         return _representationType[idTissue];
136 }
137
138 //-------------------------------------------------------------------
139 vtkActor* vtkClipping3DDataViewer::GetTissueActor(int id){
140         return _tissue[id];
141 }
142
143 //-------------------------------------------------------------------
144 boxSurfaceObserver *vtkClipping3DDataViewer::GetObserverS(int idObserverS)
145 {
146         return _observerS[idObserverS];
147 }
148 //-------------------------------------------------------------------
149 boxSurfaceObserver *vtkClipping3DDataViewer::GetObserverV()
150 {
151         return _observerV;
152 }
153
154 //-------------------------------------------------------------------
155 bool vtkClipping3DDataViewer::GetVisibleVolume()
156 {
157         return _visibleVolume;
158 }
159 //-------------------------------------------------------------------
160 void vtkClipping3DDataViewer::SetVisibleVolume(bool visiblevolume)
161 {
162         _visibleVolume = visiblevolume;
163 }
164
165
166 //-------------------------------------------------------------------
167 void vtkClipping3DDataViewer::Configure_Tissue()
168 {
169
170         double range[2];
171         int i;
172         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
173                 // Visualisation - original volume
174                 vtkImageData *imagedata=_vtkmprbasedata->GetImageData();
175                 imagedata->GetScalarRange( range );
176                 _mCubes[i] = vtkMarchingCubes::New( );
177                 _mCubes[i]->SetInput( imagedata );
178
179                 _mCubes[i]->SetValue( 0, range[1]*(4+i) / 8 );
180 //              _mCubes[i]->SetValue( 0, 1500 );
181
182             _tissueStripper[i] = vtkStripper::New();
183             _tissueStripper[i]->SetInput( _mCubes[i]->GetOutput( ) );
184
185
186
187                 _tissuePlanes[i]  = vtkPlanes::New();
188
189                 int x1,x2,y1,y2,z1,z2;
190                 imagedata->GetExtent(x1,x2,y1,y2,z1,z2);
191                 _tissuePlanes[i]->SetBounds  (x1,x2,y1,y2,z1,z2);
192
193                 _tissueClipper[i] = vtkClipPolyData::New();
194                 _tissueClipper[i]->SetInput( _tissueStripper[i]->GetOutput() );
195                 _tissueClipper[i]->SetClipFunction( _tissuePlanes[i] );
196                 _tissueClipper[i]->InsideOutOn( );
197
198                 _tissueMapper[i] = vtkPolyDataMapper::New( );
199                 _tissueMapper[i]->SetInput( _tissueClipper[i]->GetOutput() );
200                 _tissueMapper[i]->ScalarVisibilityOff( );
201 //              _tissueMapper[i]->Update();
202
203         }
204
205
206
207         // vtkActor tissue
208         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
209                 // tissue
210                 _tissue[i] = vtkActor::New();
211                 _tissue[i]->SetMapper( GetTissueMapper(i) );
212                 float cr=1,cg=0.5,cb=0.5;
213                 _tissue[i]->GetProperty()->SetDiffuseColor(cr/255, cg/255   , cb/255   );
214                 _tissue[i]->GetProperty()->SetSpecular(.3);
215                 _tissue[i]->GetProperty()->SetSpecularPower(20);
216                 _tissue[i]->GetProperty()->SetOpacity(0.5);
217                 if (i==0) _tissue[i]->GetProperty()->SetColor(0.85, 0.85   , 0.85   );
218                 if (i==1) _tissue[i]->GetProperty()->SetColor(0, 0  ,  1  );
219                 if (i==2) _tissue[i]->GetProperty()->SetColor(0.85, 0.20   , 0.20   );
220                 if (i==3) _tissue[i]->GetProperty()->SetColor(0, 1   , 0   );
221         }
222
223         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
224         {
225                 _observerS[i] = boxSurfaceObserver::New();
226                 _observerS[i]->SetPlanes( GetTissuePlanes(i) );
227                 _observerS[i]->SetActor( _tissue[i] );
228         }
229
230 }
231
232 //-----------------------------------------------------------------------------
233
234 void vtkClipping3DDataViewer::Configure_Volume()
235 {
236   // Volume
237
238
239
240  /** if(_newvol != NULL)
241   {
242     _newvol->Delete();
243     _volumeMapper->Delete();
244     _volumeProperty->Delete();
245   }*/
246
247
248
249   _tfun = vtkPiecewiseFunction::New();
250   _ctfun = vtkColorTransferFunction::New();
251
252         double range[2];
253         this->_vtkmprbasedata->GetImageData()->GetScalarRange(range);
254         double max = range[1];
255
256         /*
257         adding the poinst of the transference function
258         */
259         //X
260         greyValuesTransferenceFVector.push_back(max * 0/2);  // JPR ?? 0/2
261         greyValuesTransferenceFVector.push_back(max * 1/2);  // JPR ?? division entiere?
262         greyValuesTransferenceFVector.push_back(max * 2/2);
263         //Y
264         intensityValuesTransferenceFVector.push_back(0.0);
265         intensityValuesTransferenceFVector.push_back(1.0);
266         intensityValuesTransferenceFVector.push_back(1.0);
267
268         _tfun->AddPoint(max * 0/2 , 0.0);
269         _tfun->AddPoint(max * 1/2 , 1.0);
270         _tfun->AddPoint(max * 2/2 , 1.0);
271
272         /*
273                 Adding the colors to the vectors
274         */
275         //RED
276         redColorsOfColorTransferenceFVector.push_back(0.0);
277         redColorsOfColorTransferenceFVector.push_back(1.0);
278         redColorsOfColorTransferenceFVector.push_back(0.0);
279         redColorsOfColorTransferenceFVector.push_back(0.0);
280         redColorsOfColorTransferenceFVector.push_back(0.0);
281
282         //GREEN
283         greenColorsOfColorTransferenceFVector.push_back(0.0);
284         greenColorsOfColorTransferenceFVector.push_back(0.0);
285         greenColorsOfColorTransferenceFVector.push_back(0.0);
286         greenColorsOfColorTransferenceFVector.push_back(1.0);
287         greenColorsOfColorTransferenceFVector.push_back(0.2);
288
289         //BLUE
290         blueColorsOfColorTransferenceFVector.push_back(0.0);
291         blueColorsOfColorTransferenceFVector.push_back(0.0);
292         blueColorsOfColorTransferenceFVector.push_back(1.0);
293         blueColorsOfColorTransferenceFVector.push_back(0.0);
294         blueColorsOfColorTransferenceFVector.push_back(0.0);
295         //GREY VALUE
296         greyValueColorsOfColorTransferenceFVector.push_back(max*0/4);
297         greyValueColorsOfColorTransferenceFVector.push_back(max*1/4);
298         greyValueColorsOfColorTransferenceFVector.push_back(max*2/4);
299         greyValueColorsOfColorTransferenceFVector.push_back(max*3/4);
300         greyValueColorsOfColorTransferenceFVector.push_back(max*4/4);
301
302         _ctfun->AddRGBPoint( max*0/4 , 0.0, 0.0, 0.0);
303         _ctfun->AddRGBPoint( max*1/4 , 1.0, 0.0, 0.0);
304         _ctfun->AddRGBPoint( max*2/4 , 0.0, 0.0, 1.0);
305         _ctfun->AddRGBPoint( max*3/4 , 0.0, 1.0, 0.0);
306         _ctfun->AddRGBPoint( max*4/4 , 0.0, 0.2, 0.0);
307
308   _volumePlanes  = vtkPlanes::New();
309 //      int x1,x2,y1,y2,z1,z2;
310 //      vtkImageData *imagedata=_vtkmprbasedata->GetImageData();
311 //      imagedata->GetExtent(x1,x2,y1,y2,z1,z2);
312 //      _volumePlanes->SetBounds(x1,x2,y1,y2,z1,z2);
313
314         // EED 13/03/2011
315
316   _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
317         vtkVolumeRayCastMIPFunction* _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New();
318
319
320  // _volumeMapper = vtkVolumeRayCastMapper::New();
321         _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() );
322
323 if(_isRayCasting)
324 {
325     cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isRayCasting"<<endl;
326     _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
327
328 }
329 else if(_isMIP)
330 {
331     cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isMIP"<<endl;
332     _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
333 }
334
335 //
336
337         _volumeMapper->SetClippingPlanes( _volumePlanes );
338         _volumeMapper->AutoAdjustSampleDistancesOn();
339
340     //_volumeProperty = vtkVolumeProperty::New();
341         _volumeProperty->SetColor(_ctfun);
342         _volumeProperty->SetScalarOpacity( _tfun );
343
344 // EED 31/03/2008
345
346         _volumeProperty->DisableGradientOpacityOn();
347
348 if(_interpolation)
349 {
350     _volumeProperty->SetInterpolationTypeToLinear();
351 }
352 else
353 {
354     _volumeProperty->SetInterpolationTypeToNearest();
355 }
356
357 if(_shade)
358 {
359     _volumeProperty->ShadeOn();
360 }
361 else
362 {
363     _volumeProperty->ShadeOff();
364 }
365
366 //      _
367
368
369 //      _
370
371
372 //      _volumeProperty->SetInterpolationTypeToNearest();
373 //      _volumeProperty->ShadeOff();
374 //      _volumeProperty->SetAmbient(0.3);
375 //      _volumeProperty->SetDiffuse(0.1);
376 //      _volumeProperty->SetSpecular(0.8);
377 //      _volumeProperty->DisableGradientOpacityOn();
378
379  // _newvol = vtkVolume::New();
380         _newvol->SetMapper(_volumeMapper );
381         _newvol->SetProperty(_volumeProperty );
382
383   _observerV = boxSurfaceObserver::New();
384         _observerV->SetPlanes( _volumePlanes );
385         _observerV->SetActor( _newvol );
386         _observerV->SetvtkVolumeRayCastMapper( _volumeMapper );
387 }
388
389
390 //-------------------------------------------------------------------
391 void vtkClipping3DDataViewer::Configure()
392 {
393         Configure_Tissue();
394         Configure_Volume();
395
396   // An outline provides context around the data.
397   //
398         _outlineData = vtkOutlineFilter::New();
399     _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
400         _mapOutline = vtkPolyDataMapper::New();
401     _mapOutline->SetInput(_outlineData->GetOutput());
402         _outline = vtkActor::New();
403     _outline->SetMapper(_mapOutline);
404     _outline->GetProperty()->SetColor(0,0,0);
405 }
406
407
408 //-------------------------------------------------------------------
409 void vtkClipping3DDataViewer::SetIsovalue(int idTissue, int isoValue)
410 {
411         _mCubes[idTissue]->SetValue(0, isoValue);
412 }
413 //-------------------------------------------------------------------
414 double vtkClipping3DDataViewer::GetIsovalue(int idTissue)
415 {
416         return _mCubes[idTissue]->GetValue(0);
417 }
418 //-------------------------------------------------------------------
419 vtkVolume* vtkClipping3DDataViewer::GetVolumeActor()
420 {
421    return _newvol;
422 }
423 //-------------------------------------------------------------------
424 vtkVolumeRayCastMapper* vtkClipping3DDataViewer::GetVolumeMapper(){
425         return _volumeMapper;
426 }
427 //-------------------------------------------------------------------
428 vtkPlanes* vtkClipping3DDataViewer::GetVolumePlanes()
429 {
430         return _volumePlanes;
431 }
432
433 //-------------------------------------------------------------------
434 vtkMarchingCubes *vtkClipping3DDataViewer::GetMCubes(int idTissue)
435 {
436         return _mCubes[idTissue];
437 }
438 //--------------------------------------------------------------------
439 //-------------------
440 //Getters Vectors
441 //-------------------
442
443 std::vector<double>*    vtkClipping3DDataViewer::GetGreyValuesTransferenceFVector()
444 {
445         return &greyValuesTransferenceFVector;
446 }
447 //--------------------------------------------------------------------
448 std::vector<double>*    vtkClipping3DDataViewer::GetIntensityValuesTransferenceFVector()
449 {
450         return &intensityValuesTransferenceFVector;
451 }
452 //--------------------------------------------------------------------
453 std::vector<double>*    vtkClipping3DDataViewer::GetRedColorsOfColorTransferenceFVector()
454 {
455         return &redColorsOfColorTransferenceFVector;
456 }
457 //--------------------------------------------------------------------
458 std::vector<double>*    vtkClipping3DDataViewer::GetGreenColorsOfColorTransferenceFVector()
459 {
460         return &greenColorsOfColorTransferenceFVector;
461 }
462 //--------------------------------------------------------------------
463 std::vector<double>*    vtkClipping3DDataViewer::GetBlueColorsOfColorTransferenceFVector()
464 {
465         return &blueColorsOfColorTransferenceFVector;
466 }
467 //--------------------------------------------------------------------
468 std::vector<double>*    vtkClipping3DDataViewer::GetGreyValueColorsOfColorTransferenceFVector()
469 {
470         return &greyValueColorsOfColorTransferenceFVector;
471 }
472 //--------------------------------------------------------------------
473 //--------------------------------------
474 //Getters transference function
475 //and color of the transference function
476 //---------------------------------------
477 vtkPiecewiseFunction* vtkClipping3DDataViewer::GetTransferencefunction()
478 {
479         return this->_tfun;
480 }
481 //--------------------------------------------------------------------
482 vtkColorTransferFunction* vtkClipping3DDataViewer::GetColorTransferenceFunction()
483 {
484         return this->_ctfun;
485 }
486
487 //-------------------------------------------------------------------
488
489 void vtkClipping3DDataViewer::ReadVolumeFunctions()
490 {
491 /*
492         int i=0,xi,yi,r,g,b,gValue;
493         vtkImageData *imagedata = this->_vtkmprbasedata->GetImageData();
494
495         HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Histogram Dialog"),imagedata);
496         //
497         // put in a method
498         //
499         int tfSize=this->greyValuesTransferenceFVector.size();
500                 if(tfSize>0)
501                 {
502                         int i=0,y;
503                         hDlg->erasePointsTransferenceFunction();
504                         while(i<tfSize)
505                         {
506                                 double g=greyValuesTransferenceFVector[i];
507                                 double in=intensityValuesTransferenceFVector[i];
508                                 hDlg->addPointToTransferenceFunction(g,in*100);
509                                 i++;
510                         }
511
512                 }
513
514         int ctfSize=this->redColorsOfColorTransferenceFVector.size();
515         if(ctfSize>0)
516         {
517                 int i=0,y;
518                         while(i<ctfSize)
519                         {
520                                 double gr=greyValueColorsOfColorTransferenceFVector[i];
521                                 double r=redColorsOfColorTransferenceFVector[i];
522                                 double g=greenColorsOfColorTransferenceFVector[i];
523                                 double b=blueColorsOfColorTransferenceFVector[i];
524                                 hDlg->addColorPoint(gr,r*255,g*255,b*255);
525                                 i++;
526                         }
527         }
528         //If it is smooth activate next line
529         //hDlg->updatePlotter();
530         //setting variables if the user wants to do refresh
531         hDlg->setCTF(_ctfun);
532         hDlg->setTF(_tfun);
533
534         //
535         // when the user had changed the transference Function
536         //
537         if(hDlg->ShowModal()== wxID_OK )
538         {
539                         // -- vtkPiecewiseFunction --
540                         this->_tfun->RemoveAllPoints();
541                         greyValuesTransferenceFVector.clear();
542                         intensityValuesTransferenceFVector.clear();
543
544                         int nTFPoints=hDlg->getSizeTransferenceFunction();
545                         i=0;
546                         while(i<nTFPoints)
547                         {
548                                 hDlg->getTransferenceFunctionPoint(i,xi,yi);
549                                 this->_tfun->AddPoint( xi , yi/100.0 );
550                                 greyValuesTransferenceFVector.push_back(xi);
551                                 intensityValuesTransferenceFVector.push_back(yi/100.0);
552                                 i++;
553                         }
554                         // -- vtkColorTransferFunction  --
555                         this->_ctfun->RemoveAllPoints ();
556                         //clean colors
557                         redColorsOfColorTransferenceFVector.clear();
558                         greenColorsOfColorTransferenceFVector.clear();
559                         blueColorsOfColorTransferenceFVector.clear();
560                         greyValueColorsOfColorTransferenceFVector.clear();
561
562                         int nCTFpoints=hDlg->getSizeBarColor();
563                         i=0;
564                         while(i<nCTFpoints)
565                         {
566                                 hDlg->getDataBarColorPoint(i,xi,r,g,b);
567                                 this->_ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 );
568                                 redColorsOfColorTransferenceFVector.push_back(r/255.0);
569                                 greenColorsOfColorTransferenceFVector.push_back(g/255.0);
570                                 blueColorsOfColorTransferenceFVector.push_back(b/255.0);
571                                 greyValueColorsOfColorTransferenceFVector.push_back(xi);
572                                 i++;
573                         }
574
575                         this->_volumeMapper->Update();
576                         this->_newvol->Update();
577         }
578
579         else
580         {
581
582                 if(hDlg->getRefreshed())
583                 {
584                         int i=0,size;
585                         //--Transference Function----
586                         this->_tfun->RemoveAllPoints();
587                         i=0;
588                         size=greyValuesTransferenceFVector.size();
589                         for(i=0;i<size;i++)
590                         {
591                                 double grey1=greyValuesTransferenceFVector[i];
592                                 double  in2=intensityValuesTransferenceFVector[i];
593                                 this->_tfun->AddPoint( grey1 , in2 );
594                         }
595
596                         // -- vtkColorTransferFunction  --
597                         _ctfun->RemoveAllPoints ();
598
599                         i=0;
600                         size=greyValueColorsOfColorTransferenceFVector.size();
601                         for(i=0;i<size;i++)
602                         {
603                                 double grey2=(greyValueColorsOfColorTransferenceFVector)[i];
604                                 double red =(redColorsOfColorTransferenceFVector)[i];
605                                 double green =(greenColorsOfColorTransferenceFVector)[i];
606                                 double blue = (blueColorsOfColorTransferenceFVector)[i];
607                                 _ctfun->AddRGBPoint(grey2,red,green,blue);
608                         }
609                         this->_volumeMapper->Update();
610                         this->_newvol->Update();
611                  }
612
613         }
614         hDlg->Destroy();
615 */
616 }
617 /*
618 void vtkClipping3DDataViewer::ReadVolumeFunctions(char *namefile)
619 {
620         char tmp[256];
621         short int       max;
622         double          range[2];
623         double          x,val,r,g,b;
624
625         FILE *ff = fopen ( namefile ,"r");
626
627         // --  MAX  --
628         fscanf(ff,"%s",tmp);
629         if (strcmp(tmp,"MAX")==0)
630         {
631                 vtkImageData *vtkimagedata              = this->_vtkmprbasedata->GetImageData();
632                 vtkimagedata->GetScalarRange(range);
633                 max = (int) (range[1]);
634         } else {
635                 max = atoi(tmp);
636         }
637
638         fscanf(ff,"%s",tmp);   // --
639
640         // -- vtkPiecewiseFunction --
641         this->_tfun->RemoveAllPoints();
642         fscanf(ff,"%s",tmp);
643         while ( strcmp(tmp,"--")!=0 )
644         {
645                 x=atof(tmp);
646                 fscanf(ff,"%s",tmp);
647                 val=atof(tmp);
648                 this->_tfun->AddPoint( x*max , val );
649                 fscanf(ff,"%s",tmp);
650         }
651
652         this->_ctfun->RemoveAllPoints ();
653         // -- vtkColorTransferFunction  --
654         while ( !feof(ff))
655         {
656                 fscanf(ff,"%s",tmp);
657                 x=atof(tmp);
658                 fscanf(ff,"%s",tmp);
659                 r=atof(tmp);
660                 fscanf(ff,"%s",tmp);
661                 g=atof(tmp);
662                 fscanf(ff,"%s",tmp);
663                 b=atof(tmp);
664                 this->_ctfun->AddRGBPoint( x*max , r,g,b );
665         }
666
667
668         this->_volumeMapper->Update();
669         this->_newvol->Update();
670
671
672         fclose(ff);
673 }
674 */
675
676 //-------------------------------------------------------------------
677 // EED 23 Mai 2007
678 void vtkClipping3DDataViewer::ReadMeshVTK(char *namefile)
679 {
680         vtkDataSetReader *reader = vtkDataSetReader::New();
681         reader->SetFileName(namefile);
682         reader->Update();
683         _tissueStripper[3]->SetInput( reader->GetPolyDataOutput()  );
684 }
685
686 void vtkClipping3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){
687
688         _volumeProperty->SetColor(colortable);
689
690 }
691
692
693 void vtkClipping3DDataViewer::SetRayCasting(bool active)
694 {
695     _isRayCasting   =   active;
696
697 }
698
699 void vtkClipping3DDataViewer::SetMIPActive(bool active)
700 {
701     _isMIP  = active;
702 }
703
704 void vtkClipping3DDataViewer::SetInterpolation(bool active)
705 {
706     _interpolation = active;
707 }
708
709 void vtkClipping3DDataViewer::SetShade(bool active)
710 {
711     _shade  =   active;
712 }
713