1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
27 #include "vtkClipping3DDataViewer.h"
28 #include "vtkDataSetReader.h"
29 #include "vtkProperty.h"
31 vtkClipping3DDataViewer::vtkClipping3DDataViewer()
34 for (i=0; i<VTKMPRDATA_MAXTISSUE; i++){
35 _visibleTissue[i] = false;
36 _representationType[i] = true;
38 _visibleVolume = false;
41 _interpolation = false;
44 _volumerendererdata = VolumeRendererData::New();
45 _volumeMapper = vtkVolumeRayCastMapper::New();
46 _newvol = vtkVolume::New();
47 _volumeProperty = vtkVolumeProperty::New();
48 _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
49 _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New();
52 //-------------------------------------------------------------------
53 vtkClipping3DDataViewer::~vtkClipping3DDataViewer()
56 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
58 _tissueStripper[i]->Delete();
59 _tissueMapper[i]->Delete();
60 _tissuePlanes[i]->Delete();
61 _tissueClipper[i]->Delete();
67 _compositeFunction->Delete();
68 _volumeMapper->Delete();
69 _volumeProperty->Delete();
71 _volumePlanes->Delete();
73 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
74 _tissue[i]-> Delete();
75 _observerS[i]-> Delete();
77 _observerV-> Delete();
80 //-------------------------------------------------------------------
81 vtkClipPolyData* vtkClipping3DDataViewer::GetTissueClipper(int id)
83 return this->_tissueClipper[id];
85 //-------------------------------------------------------------------
86 vtkPolyDataMapper* vtkClipping3DDataViewer::GetTissueMapper(int id)
88 return _tissueMapper[id];
90 //-------------------------------------------------------------------
91 vtkPlanes* vtkClipping3DDataViewer::GetTissuePlanes(int id)
93 return _tissuePlanes[id];
95 //-------------------------------------------------------------------
96 vtkStripper* vtkClipping3DDataViewer::GetTissueStripper(int id)
98 return _tissueStripper[id];
100 //-------------------------------------------------------------------
101 void vtkClipping3DDataViewer::Refresh()
103 // _volumeMapper->SetClippingPlanes(_volumePlanes);
105 // this->_volumeMapper->Update();
106 // this->_newvol->Update();
108 // _newvol->VisibilityOn();
111 // _volumeMapper = vtkVolumeRayCastMapper::New();
112 // _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() );
113 // _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
114 // _volumeMapper->SetClippingPlanes( _volumePlanes );
115 // _newvol->SetMapper(_volumeMapper );
119 //-------------------------------------------------------------------
120 void vtkClipping3DDataViewer::RefreshSurface()
123 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
125 SetIsovalue(i, (int) (GetIsovalue(i)+1) );
126 // this->GetMCubes(i)->Update();
129 //-------------------------------------------------------------------
130 void vtkClipping3DDataViewer::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
132 _vtkmprbasedata=vtkmprbasedata;
134 //-------------------------------------------------------------------
135 vtkMPRBaseData* vtkClipping3DDataViewer::GetVtkMPRBaseData()
137 return _vtkmprbasedata;
141 //-------------------------------------------------------------------
142 void vtkClipping3DDataViewer::SetVisibleTissue(int idTissue, bool visible)
144 _visibleTissue[idTissue]=visible;
146 //-------------------------------------------------------------------
147 bool vtkClipping3DDataViewer::GetVisibleTissue(int idTissue){
148 return _visibleTissue[idTissue];
150 //-------------------------------------------------------------------
151 void vtkClipping3DDataViewer::SetRepresentationType(int idTissue, bool representationType)
153 _representationType[idTissue]=representationType;
155 //-------------------------------------------------------------------
156 bool vtkClipping3DDataViewer::GetRepresentationType(int idTissue)
158 return _representationType[idTissue];
161 //-------------------------------------------------------------------
162 vtkActor* vtkClipping3DDataViewer::GetTissueActor(int id){
166 //-------------------------------------------------------------------
167 boxSurfaceObserver *vtkClipping3DDataViewer::GetObserverS(int idObserverS)
169 return _observerS[idObserverS];
171 //-------------------------------------------------------------------
172 boxSurfaceObserver *vtkClipping3DDataViewer::GetObserverV()
177 //-------------------------------------------------------------------
178 bool vtkClipping3DDataViewer::GetVisibleVolume()
180 return _visibleVolume;
182 //-------------------------------------------------------------------
183 void vtkClipping3DDataViewer::SetVisibleVolume(bool visiblevolume)
185 _visibleVolume = visiblevolume;
188 bool vtkClipping3DDataViewer::GetVisibleVolumeBox()
190 return _visibleVolumeBox;
192 //-------------------------------------------------------------------
193 void vtkClipping3DDataViewer::SetVisibleVolumeBox(bool visibleBox)
195 _visibleVolumeBox = visibleBox;
199 //-------------------------------------------------------------------
200 void vtkClipping3DDataViewer::SetImage()
203 vtkImageData *imagedata=_vtkmprbasedata->GetImageData();
204 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
206 //EED 2017-01-01 Migration VTK7
207 #if VTK_MAJOR_VERSION <= 5
208 _mCubes[i]->SetInput( imagedata );
210 _mCubes[i]->SetInputData( imagedata );
213 //EED 2017-01-01 Migration VTK7
214 #if VTK_MAJOR_VERSION <= 5
215 _volumeMapper->SetInput( imagedata );
217 _volumeMapper->SetInputData( imagedata );
219 _volumerendererdata->SetImageData( imagedata );
222 //-------------------------------------------------------------------
223 void vtkClipping3DDataViewer::Configure_Tissue()
227 vtkImageData *imagedata=_vtkmprbasedata->GetImageData();
228 imagedata->GetScalarRange( range );
229 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
231 // Visualisation - original volume
232 _mCubes[i] = vtkMarchingCubes::New( );
234 //EED 2017-01-01 Migration VTK7
235 #if VTK_MAJOR_VERSION <= 5
236 _mCubes[i]->SetInput( imagedata );
238 _mCubes[i]->SetInputData( imagedata );
241 _mCubes[i]->SetValue( 0, range[1]*(4+i) / 8 );
242 // _mCubes[i]->SetValue( 0, 1500 );
243 _tissueStripper[i] = vtkStripper::New();
245 //EED 2017-01-01 Migration VTK7
246 #if VTK_MAJOR_VERSION <= 5
247 _tissueStripper[i]->SetInput( _mCubes[i]->GetOutput( ) );
249 _tissueStripper[i]->SetInputData( _mCubes[i]->GetOutput( ) );
252 _tissuePlanes[i] = vtkPlanes::New();
253 int x1,x2,y1,y2,z1,z2;
254 imagedata->GetExtent(x1,x2,y1,y2,z1,z2);
255 _tissuePlanes[i]->SetBounds (x1,x2,y1,y2,z1,z2);
256 _tissueClipper[i] = vtkClipPolyData::New();
257 _tissueClipper[i]->SetClipFunction( _tissuePlanes[i] );
258 _tissueClipper[i]->InsideOutOn( );
260 //EED 2017-01-01 Migration VTK7
261 #if VTK_MAJOR_VERSION <= 5
262 _tissueClipper[i]->SetInput( _tissueStripper[i]->GetOutput() );
264 _tissueClipper[i]->SetInputData( _tissueStripper[i]->GetOutput() );
265 printf("EED vtkClipping3DDataViewer::Configure_Tissue Update\n");
266 _tissueClipper[i]->Update();
269 _tissueMapper[i] = vtkPolyDataMapper::New( );
271 //EED 2017-01-01 Migration VTK7
272 #if VTK_MAJOR_VERSION <= 5
273 _tissueMapper[i]->SetInput( _tissueClipper[i]->GetOutput() );
275 _tissueMapper[i]->SetInputData( _tissueClipper[i]->GetOutput() );
276 _tissueMapper[i]->Update();
280 _tissueMapper[i]->ScalarVisibilityOff( );
281 // _tissueMapper[i]->Update();
285 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
287 _tissue[i] = vtkActor::New();
288 _tissue[i]->SetMapper( GetTissueMapper(i) );
289 float cr=1,cg=0.5,cb=0.5;
290 _tissue[i]->GetProperty()->SetDiffuseColor(cr/255, cg/255 , cb/255 );
291 _tissue[i]->GetProperty()->SetSpecular(.3);
292 _tissue[i]->GetProperty()->SetSpecularPower(20);
293 _tissue[i]->GetProperty()->SetOpacity(0.5);
294 if (i==0) _tissue[i]->GetProperty()->SetColor(0.85, 0.85 , 0.85 );
295 if (i==1) _tissue[i]->GetProperty()->SetColor(0, 0 , 1 );
296 if (i==2) _tissue[i]->GetProperty()->SetColor(0.85, 0.20 , 0.20 );
297 if (i==3) _tissue[i]->GetProperty()->SetColor(0, 1 , 0 );
300 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
302 _observerS[i] = boxSurfaceObserver::New();
303 _observerS[i]->SetPlanes( GetTissuePlanes(i) );
304 _observerS[i]->SetActor( _tissue[i] );
309 //-----------------------------------------------------------------------------
311 void vtkClipping3DDataViewer::Configure_Volume()
315 /** if(_newvol != NULL)
318 _volumeMapper->Delete();
319 _volumeProperty->Delete();
322 _tfun = vtkPiecewiseFunction::New();
323 _ctfun = vtkColorTransferFunction::New();
326 this->_vtkmprbasedata->GetImageData()->GetScalarRange(range);
327 double max = range[1];
330 adding the poinst of the transference function
333 greyValuesTransferenceFVector.push_back(max * 0/2); // JPR ?? 0/2
334 greyValuesTransferenceFVector.push_back(max * 1/2); // JPR ?? division entiere?
335 greyValuesTransferenceFVector.push_back(max * 2/2);
337 intensityValuesTransferenceFVector.push_back(0.0);
338 intensityValuesTransferenceFVector.push_back(1.0);
339 intensityValuesTransferenceFVector.push_back(1.0);
341 _tfun->AddPoint(max * 0/2 , 0.0);
342 _tfun->AddPoint(max * 1/2 , 1.0);
343 _tfun->AddPoint(max * 2/2 , 1.0);
346 Adding the colors to the vectors
349 redColorsOfColorTransferenceFVector.push_back(0.0);
350 redColorsOfColorTransferenceFVector.push_back(1.0);
351 redColorsOfColorTransferenceFVector.push_back(0.0);
352 redColorsOfColorTransferenceFVector.push_back(0.0);
353 redColorsOfColorTransferenceFVector.push_back(0.0);
356 greenColorsOfColorTransferenceFVector.push_back(0.0);
357 greenColorsOfColorTransferenceFVector.push_back(0.0);
358 greenColorsOfColorTransferenceFVector.push_back(0.0);
359 greenColorsOfColorTransferenceFVector.push_back(1.0);
360 greenColorsOfColorTransferenceFVector.push_back(0.2);
363 blueColorsOfColorTransferenceFVector.push_back(0.0);
364 blueColorsOfColorTransferenceFVector.push_back(0.0);
365 blueColorsOfColorTransferenceFVector.push_back(1.0);
366 blueColorsOfColorTransferenceFVector.push_back(0.0);
367 blueColorsOfColorTransferenceFVector.push_back(0.0);
369 greyValueColorsOfColorTransferenceFVector.push_back(max*0/4);
370 greyValueColorsOfColorTransferenceFVector.push_back(max*1/4);
371 greyValueColorsOfColorTransferenceFVector.push_back(max*2/4);
372 greyValueColorsOfColorTransferenceFVector.push_back(max*3/4);
373 greyValueColorsOfColorTransferenceFVector.push_back(max*4/4);
375 _ctfun->AddRGBPoint( max*0/4 , 0.0, 0.0, 0.0);
376 _ctfun->AddRGBPoint( max*1/4 , 1.0, 0.0, 0.0);
377 _ctfun->AddRGBPoint( max*2/4 , 0.0, 0.0, 1.0);
378 _ctfun->AddRGBPoint( max*3/4 , 0.0, 1.0, 0.0);
379 _ctfun->AddRGBPoint( max*4/4 , 0.0, 0.2, 0.0);
381 _volumePlanes = vtkPlanes::New();
382 // int x1,x2,y1,y2,z1,z2;
383 // vtkImageData *imagedata=_vtkmprbasedata->GetImageData();
384 // imagedata->GetExtent(x1,x2,y1,y2,z1,z2);
385 // _volumePlanes->SetBounds(x1,x2,y1,y2,z1,z2);
389 // _volumeMapper = vtkVolumeRayCastMapper::New();
392 //EED 2017-01-01 Migration VTK7
393 #if VTK_MAJOR_VERSION <= 5
394 _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() );
396 _volumeMapper->SetInputData( this->GetVtkMPRBaseData()->GetImageData() );
400 _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
402 // _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
405 _volumeMapper->SetClippingPlanes( _volumePlanes );
406 _volumeMapper->AutoAdjustSampleDistancesOn();
408 _volumeProperty->SetInterpolationTypeToNearest();
409 //_volumeProperty = vtkVolumeProperty::New();
410 _volumeProperty->SetColor(_ctfun);
411 _volumeProperty->SetScalarOpacity( _tfun );
414 _volumeProperty->DisableGradientOpacityOn();
417 // _volumeProperty->SetInterpolationTypeToNearest();
418 // _volumeProperty->ShadeOff();
419 // _volumeProperty->SetAmbient(0.3);
420 // _volumeProperty->SetDiffuse(0.1);
421 // _volumeProperty->SetSpecular(0.8);
422 // _volumeProperty->DisableGradientOpacityOn();
424 // _newvol = vtkVolume::New();
425 _newvol->SetMapper(_volumeMapper );
426 _newvol->SetProperty(_volumeProperty );
428 _observerV = boxSurfaceObserver::New();
429 _observerV->SetPlanes( _volumePlanes );
430 _observerV->SetActor( _newvol );
431 _observerV->SetvtkVolumeRayCastMapper( _volumeMapper );
434 //-----------------------------------------------------------------------------
436 void vtkClipping3DDataViewer::Configure_VolumeBox()
438 _volumerendererdata->SetImageData(_vtkmprbasedata->GetImageData());
441 vector<double> *gv = this->GetGreyValuesTransferenceFVector();
442 vector<double> *op = this->GetIntensityValuesTransferenceFVector();
444 _volumerendererdata->SetLookUpTable((vtkLookupTable*)(_ctfun));
445 _volumerendererdata->OpacityChanged(*gv, *op);
447 //_wxvtkclipping3Dview->VisibleVolumeActor( false );
448 //_volumerendererdata->ShowVolume(event.IsChecked() );
449 //_volumerendererdata->BoundingBoxChanged(event.IsChecked() );
452 //-----------------------------------------------------------------------------
454 void vtkClipping3DDataViewer::SetRenderer(vtkRenderer* renderer)
456 _volumerendererdata->SetRenderer(renderer);
460 //-----------------------------------------------------------------------------
461 void vtkClipping3DDataViewer::SetInteractor(vtkRenderWindowInteractor* interactor)
464 _volumerendererdata->SetInteractor(interactor);
468 //-----------------------------------------------------------------------------
469 void vtkClipping3DDataViewer::BoxActorChanged(bool changed)
471 vector<double> *gv = this->GetGreyValuesTransferenceFVector();
472 vector<double> *op = this->GetIntensityValuesTransferenceFVector();
474 _volumerendererdata->ShowVolume(changed);
475 _volumerendererdata->OpacityChanged(*gv, *op);
476 _volumerendererdata->BoundingBoxChanged(changed);
480 //-----------------------------------------------------------------------------
481 void vtkClipping3DDataViewer::UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun)
483 _volumerendererdata->SetLookUpTable((vtkLookupTable*)(ctfun));
484 _volumerendererdata->OpacityChanged(gf, vf);
488 //-----------------------------------------------------------------------------
489 void vtkClipping3DDataViewer::updateVolume()
494 _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
495 _volumerendererdata->changeCompositeMIPFunction(0);
499 _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
500 _volumerendererdata->changeCompositeMIPFunction(1);
505 _volumeProperty->SetInterpolationTypeToLinear();
509 _volumeProperty->SetInterpolationTypeToNearest();
514 _volumeProperty->ShadeOn();
518 _volumeProperty->ShadeOff();
523 //-------------------------------------------------------------------
524 void vtkClipping3DDataViewer::Configure()
528 Configure_VolumeBox();
532 //-------------------------------------------------------------------
533 void vtkClipping3DDataViewer::SetIsovalue(int idTissue, int isoValue)
535 _mCubes[idTissue]->SetValue(0, isoValue);
537 //-------------------------------------------------------------------
538 double vtkClipping3DDataViewer::GetIsovalue(int idTissue)
540 return _mCubes[idTissue]->GetValue(0);
542 //-------------------------------------------------------------------
543 vtkVolume* vtkClipping3DDataViewer::GetVolumeActor()
547 //-------------------------------------------------------------------
548 vtkVolumeRayCastMapper* vtkClipping3DDataViewer::GetVolumeMapper(){
549 return _volumeMapper;
551 //-------------------------------------------------------------------
552 vtkPlanes* vtkClipping3DDataViewer::GetVolumePlanes()
554 return _volumePlanes;
557 //-------------------------------------------------------------------
558 vtkMarchingCubes *vtkClipping3DDataViewer::GetMCubes(int idTissue)
560 return _mCubes[idTissue];
562 //--------------------------------------------------------------------
563 //-------------------
565 //-------------------
567 std::vector<double>* vtkClipping3DDataViewer::GetGreyValuesTransferenceFVector()
569 return &greyValuesTransferenceFVector;
571 //--------------------------------------------------------------------
572 std::vector<double>* vtkClipping3DDataViewer::GetIntensityValuesTransferenceFVector()
574 return &intensityValuesTransferenceFVector;
576 //--------------------------------------------------------------------
577 std::vector<double>* vtkClipping3DDataViewer::GetRedColorsOfColorTransferenceFVector()
579 return &redColorsOfColorTransferenceFVector;
581 //--------------------------------------------------------------------
582 std::vector<double>* vtkClipping3DDataViewer::GetGreenColorsOfColorTransferenceFVector()
584 return &greenColorsOfColorTransferenceFVector;
586 //--------------------------------------------------------------------
587 std::vector<double>* vtkClipping3DDataViewer::GetBlueColorsOfColorTransferenceFVector()
589 return &blueColorsOfColorTransferenceFVector;
591 //--------------------------------------------------------------------
592 std::vector<double>* vtkClipping3DDataViewer::GetGreyValueColorsOfColorTransferenceFVector()
594 return &greyValueColorsOfColorTransferenceFVector;
596 //--------------------------------------------------------------------
597 //--------------------------------------
598 //Getters transference function
599 //and color of the transference function
600 //---------------------------------------
601 vtkPiecewiseFunction* vtkClipping3DDataViewer::GetTransferencefunction()
605 //--------------------------------------------------------------------
606 vtkColorTransferFunction* vtkClipping3DDataViewer::GetColorTransferenceFunction()
611 //-------------------------------------------------------------------
613 void vtkClipping3DDataViewer::ReadVolumeFunctions()
616 int i=0,xi,yi,r,g,b,gValue;
617 vtkImageData *imagedata = this->_vtkmprbasedata->GetImageData();
619 HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Histogram Dialog"),imagedata);
623 int tfSize=this->greyValuesTransferenceFVector.size();
627 hDlg->erasePointsTransferenceFunction();
630 double g=greyValuesTransferenceFVector[i];
631 double in=intensityValuesTransferenceFVector[i];
632 hDlg->addPointToTransferenceFunction(g,in*100);
638 int ctfSize=this->redColorsOfColorTransferenceFVector.size();
644 double gr=greyValueColorsOfColorTransferenceFVector[i];
645 double r=redColorsOfColorTransferenceFVector[i];
646 double g=greenColorsOfColorTransferenceFVector[i];
647 double b=blueColorsOfColorTransferenceFVector[i];
648 hDlg->addColorPoint(gr,r*255,g*255,b*255);
652 //If it is smooth activate next line
653 //hDlg->updatePlotter();
654 //setting variables if the user wants to do refresh
655 hDlg->setCTF(_ctfun);
659 // when the user had changed the transference Function
661 if(hDlg->ShowModal()== wxID_OK )
663 // -- vtkPiecewiseFunction --
664 this->_tfun->RemoveAllPoints();
665 greyValuesTransferenceFVector.clear();
666 intensityValuesTransferenceFVector.clear();
668 int nTFPoints=hDlg->getSizeTransferenceFunction();
672 hDlg->getTransferenceFunctionPoint(i,xi,yi);
673 this->_tfun->AddPoint( xi , yi/100.0 );
674 greyValuesTransferenceFVector.push_back(xi);
675 intensityValuesTransferenceFVector.push_back(yi/100.0);
678 // -- vtkColorTransferFunction --
679 this->_ctfun->RemoveAllPoints ();
681 redColorsOfColorTransferenceFVector.clear();
682 greenColorsOfColorTransferenceFVector.clear();
683 blueColorsOfColorTransferenceFVector.clear();
684 greyValueColorsOfColorTransferenceFVector.clear();
686 int nCTFpoints=hDlg->getSizeBarColor();
690 hDlg->getDataBarColorPoint(i,xi,r,g,b);
691 this->_ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 );
692 redColorsOfColorTransferenceFVector.push_back(r/255.0);
693 greenColorsOfColorTransferenceFVector.push_back(g/255.0);
694 blueColorsOfColorTransferenceFVector.push_back(b/255.0);
695 greyValueColorsOfColorTransferenceFVector.push_back(xi);
699 this->_volumeMapper->Update();
700 this->_newvol->Update();
706 if(hDlg->getRefreshed())
709 //--Transference Function----
710 this->_tfun->RemoveAllPoints();
712 size=greyValuesTransferenceFVector.size();
715 double grey1=greyValuesTransferenceFVector[i];
716 double in2=intensityValuesTransferenceFVector[i];
717 this->_tfun->AddPoint( grey1 , in2 );
720 // -- vtkColorTransferFunction --
721 _ctfun->RemoveAllPoints ();
724 size=greyValueColorsOfColorTransferenceFVector.size();
727 double grey2=(greyValueColorsOfColorTransferenceFVector)[i];
728 double red =(redColorsOfColorTransferenceFVector)[i];
729 double green =(greenColorsOfColorTransferenceFVector)[i];
730 double blue = (blueColorsOfColorTransferenceFVector)[i];
731 _ctfun->AddRGBPoint(grey2,red,green,blue);
733 this->_volumeMapper->Update();
734 this->_newvol->Update();
742 void vtkClipping3DDataViewer::ReadVolumeFunctions(char *namefile)
749 FILE *ff = fopen ( namefile ,"r");
753 if (strcmp(tmp,"MAX")==0)
755 vtkImageData *vtkimagedata = this->_vtkmprbasedata->GetImageData();
756 vtkimagedata->GetScalarRange(range);
757 max = (int) (range[1]);
762 fscanf(ff,"%s",tmp); // --
764 // -- vtkPiecewiseFunction --
765 this->_tfun->RemoveAllPoints();
767 while ( strcmp(tmp,"--")!=0 )
772 this->_tfun->AddPoint( x*max , val );
776 this->_ctfun->RemoveAllPoints ();
777 // -- vtkColorTransferFunction --
788 this->_ctfun->AddRGBPoint( x*max , r,g,b );
792 this->_volumeMapper->Update();
793 this->_newvol->Update();
800 //-------------------------------------------------------------------
802 void vtkClipping3DDataViewer::ReadMeshVTK(char *namefile)
804 vtkDataSetReader *reader = vtkDataSetReader::New();
805 reader->SetFileName(namefile);
808 //EED 2017-01-01 Migration VTK7
809 #if VTK_MAJOR_VERSION <= 5
810 _tissueStripper[3]->SetInput( reader->GetPolyDataOutput() );
812 _tissueStripper[3]->SetInputData( reader->GetPolyDataOutput() );
817 void vtkClipping3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){
819 _volumeProperty->SetColor(colortable);
824 void vtkClipping3DDataViewer::SetRayCasting(bool active)
826 _isRayCasting = active;
830 void vtkClipping3DDataViewer::SetMIPActive(bool active)
835 void vtkClipping3DDataViewer::SetInterpolation(bool active)
837 _interpolation = active;
840 void vtkClipping3DDataViewer::SetShade(bool active)