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();
63 _outlineData->Delete();
64 _mapOutline->Delete();
69 _compositeFunction->Delete();
70 _volumeMapper->Delete();
71 _volumeProperty->Delete();
73 _volumePlanes->Delete();
75 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
76 _tissue[i]-> Delete();
77 _observerS[i]-> Delete();
79 _observerV-> Delete();
81 //-------------------------------------------------------------------
82 vtkActor* vtkClipping3DDataViewer::GetOutlineActor()
86 //-------------------------------------------------------------------
87 vtkClipPolyData* vtkClipping3DDataViewer::GetTissueClipper(int id)
89 return this->_tissueClipper[id];
91 //-------------------------------------------------------------------
92 vtkPolyDataMapper* vtkClipping3DDataViewer::GetTissueMapper(int id)
94 return _tissueMapper[id];
96 //-------------------------------------------------------------------
97 vtkPlanes* vtkClipping3DDataViewer::GetTissuePlanes(int id)
99 return _tissuePlanes[id];
101 //-------------------------------------------------------------------
102 vtkStripper* vtkClipping3DDataViewer::GetTissueStripper(int id)
104 return _tissueStripper[id];
106 //-------------------------------------------------------------------
107 void vtkClipping3DDataViewer::Refresh()
109 // _volumeMapper->SetClippingPlanes(_volumePlanes);
111 // this->_volumeMapper->Update();
112 // this->_newvol->Update();
114 // _newvol->VisibilityOn();
117 // _volumeMapper = vtkVolumeRayCastMapper::New();
118 // _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() );
119 // _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
120 // _volumeMapper->SetClippingPlanes( _volumePlanes );
121 // _newvol->SetMapper(_volumeMapper );
125 //-------------------------------------------------------------------
126 void vtkClipping3DDataViewer::RefreshSurface()
129 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
131 SetIsovalue(i, (int) (GetIsovalue(i)+1) );
132 // this->GetMCubes(i)->Update();
135 //-------------------------------------------------------------------
136 void vtkClipping3DDataViewer::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
138 _vtkmprbasedata=vtkmprbasedata;
140 //-------------------------------------------------------------------
141 vtkMPRBaseData* vtkClipping3DDataViewer::GetVtkMPRBaseData()
143 return _vtkmprbasedata;
147 //-------------------------------------------------------------------
148 void vtkClipping3DDataViewer::SetVisibleTissue(int idTissue, bool visible)
150 _visibleTissue[idTissue]=visible;
152 //-------------------------------------------------------------------
153 bool vtkClipping3DDataViewer::GetVisibleTissue(int idTissue){
154 return _visibleTissue[idTissue];
156 //-------------------------------------------------------------------
157 void vtkClipping3DDataViewer::SetRepresentationType(int idTissue, bool representationType)
159 _representationType[idTissue]=representationType;
161 //-------------------------------------------------------------------
162 bool vtkClipping3DDataViewer::GetRepresentationType(int idTissue)
164 return _representationType[idTissue];
167 //-------------------------------------------------------------------
168 vtkActor* vtkClipping3DDataViewer::GetTissueActor(int id){
172 //-------------------------------------------------------------------
173 boxSurfaceObserver *vtkClipping3DDataViewer::GetObserverS(int idObserverS)
175 return _observerS[idObserverS];
177 //-------------------------------------------------------------------
178 boxSurfaceObserver *vtkClipping3DDataViewer::GetObserverV()
183 //-------------------------------------------------------------------
184 bool vtkClipping3DDataViewer::GetVisibleVolume()
186 return _visibleVolume;
188 //-------------------------------------------------------------------
189 void vtkClipping3DDataViewer::SetVisibleVolume(bool visiblevolume)
191 _visibleVolume = visiblevolume;
194 bool vtkClipping3DDataViewer::GetVisibleVolumeBox()
196 return _visibleVolumeBox;
198 //-------------------------------------------------------------------
199 void vtkClipping3DDataViewer::SetVisibleVolumeBox(bool visibleBox)
201 _visibleVolumeBox = visibleBox;
205 //-------------------------------------------------------------------
206 void vtkClipping3DDataViewer::SetImage()
209 vtkImageData *imagedata=_vtkmprbasedata->GetImageData();
210 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
212 //EED 2017-01-01 Migration VTK7
213 #if VTK_MAJOR_VERSION <= 5
214 _mCubes[i]->SetInput( imagedata );
216 _mCubes[i]->SetInputData( imagedata );
219 //EED 2017-01-01 Migration VTK7
220 #if VTK_MAJOR_VERSION <= 5
221 _volumeMapper->SetInput( imagedata );
223 _volumeMapper->SetInputData( imagedata );
225 _volumerendererdata->SetImageData( imagedata );
228 //-------------------------------------------------------------------
229 void vtkClipping3DDataViewer::Configure_Tissue()
233 vtkImageData *imagedata=_vtkmprbasedata->GetImageData();
234 imagedata->GetScalarRange( range );
235 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
237 // Visualisation - original volume
238 _mCubes[i] = vtkMarchingCubes::New( );
240 //EED 2017-01-01 Migration VTK7
241 #if VTK_MAJOR_VERSION <= 5
242 _mCubes[i]->SetInput( imagedata );
244 _mCubes[i]->SetInputData( imagedata );
247 _mCubes[i]->SetValue( 0, range[1]*(4+i) / 8 );
248 // _mCubes[i]->SetValue( 0, 1500 );
249 _tissueStripper[i] = vtkStripper::New();
251 //EED 2017-01-01 Migration VTK7
252 #if VTK_MAJOR_VERSION <= 5
253 _tissueStripper[i]->SetInput( _mCubes[i]->GetOutput( ) );
255 _tissueStripper[i]->SetInputData( _mCubes[i]->GetOutput( ) );
258 _tissuePlanes[i] = vtkPlanes::New();
259 int x1,x2,y1,y2,z1,z2;
260 imagedata->GetExtent(x1,x2,y1,y2,z1,z2);
261 _tissuePlanes[i]->SetBounds (x1,x2,y1,y2,z1,z2);
262 _tissueClipper[i] = vtkClipPolyData::New();
264 //EED 2017-01-01 Migration VTK7
265 #if VTK_MAJOR_VERSION <= 5
266 _tissueClipper[i]->SetInput( _tissueStripper[i]->GetOutput() );
268 _tissueClipper[i]->SetInputData( _tissueStripper[i]->GetOutput() );
271 _tissueClipper[i]->SetClipFunction( _tissuePlanes[i] );
272 _tissueClipper[i]->InsideOutOn( );
273 _tissueMapper[i] = vtkPolyDataMapper::New( );
275 //EED 2017-01-01 Migration VTK7
276 #if VTK_MAJOR_VERSION <= 5
277 _tissueMapper[i]->SetInput( _tissueClipper[i]->GetOutput() );
279 _tissueMapper[i]->SetInputData( _tissueClipper[i]->GetOutput() );
283 _tissueMapper[i]->ScalarVisibilityOff( );
284 // _tissueMapper[i]->Update();
288 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
290 _tissue[i] = vtkActor::New();
291 _tissue[i]->SetMapper( GetTissueMapper(i) );
292 float cr=1,cg=0.5,cb=0.5;
293 _tissue[i]->GetProperty()->SetDiffuseColor(cr/255, cg/255 , cb/255 );
294 _tissue[i]->GetProperty()->SetSpecular(.3);
295 _tissue[i]->GetProperty()->SetSpecularPower(20);
296 _tissue[i]->GetProperty()->SetOpacity(0.5);
297 if (i==0) _tissue[i]->GetProperty()->SetColor(0.85, 0.85 , 0.85 );
298 if (i==1) _tissue[i]->GetProperty()->SetColor(0, 0 , 1 );
299 if (i==2) _tissue[i]->GetProperty()->SetColor(0.85, 0.20 , 0.20 );
300 if (i==3) _tissue[i]->GetProperty()->SetColor(0, 1 , 0 );
303 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
305 _observerS[i] = boxSurfaceObserver::New();
306 _observerS[i]->SetPlanes( GetTissuePlanes(i) );
307 _observerS[i]->SetActor( _tissue[i] );
312 //-----------------------------------------------------------------------------
314 void vtkClipping3DDataViewer::Configure_Volume()
318 /** if(_newvol != NULL)
321 _volumeMapper->Delete();
322 _volumeProperty->Delete();
325 _tfun = vtkPiecewiseFunction::New();
326 _ctfun = vtkColorTransferFunction::New();
329 this->_vtkmprbasedata->GetImageData()->GetScalarRange(range);
330 double max = range[1];
333 adding the poinst of the transference function
336 greyValuesTransferenceFVector.push_back(max * 0/2); // JPR ?? 0/2
337 greyValuesTransferenceFVector.push_back(max * 1/2); // JPR ?? division entiere?
338 greyValuesTransferenceFVector.push_back(max * 2/2);
340 intensityValuesTransferenceFVector.push_back(0.0);
341 intensityValuesTransferenceFVector.push_back(1.0);
342 intensityValuesTransferenceFVector.push_back(1.0);
344 _tfun->AddPoint(max * 0/2 , 0.0);
345 _tfun->AddPoint(max * 1/2 , 1.0);
346 _tfun->AddPoint(max * 2/2 , 1.0);
349 Adding the colors to the vectors
352 redColorsOfColorTransferenceFVector.push_back(0.0);
353 redColorsOfColorTransferenceFVector.push_back(1.0);
354 redColorsOfColorTransferenceFVector.push_back(0.0);
355 redColorsOfColorTransferenceFVector.push_back(0.0);
356 redColorsOfColorTransferenceFVector.push_back(0.0);
359 greenColorsOfColorTransferenceFVector.push_back(0.0);
360 greenColorsOfColorTransferenceFVector.push_back(0.0);
361 greenColorsOfColorTransferenceFVector.push_back(0.0);
362 greenColorsOfColorTransferenceFVector.push_back(1.0);
363 greenColorsOfColorTransferenceFVector.push_back(0.2);
366 blueColorsOfColorTransferenceFVector.push_back(0.0);
367 blueColorsOfColorTransferenceFVector.push_back(0.0);
368 blueColorsOfColorTransferenceFVector.push_back(1.0);
369 blueColorsOfColorTransferenceFVector.push_back(0.0);
370 blueColorsOfColorTransferenceFVector.push_back(0.0);
372 greyValueColorsOfColorTransferenceFVector.push_back(max*0/4);
373 greyValueColorsOfColorTransferenceFVector.push_back(max*1/4);
374 greyValueColorsOfColorTransferenceFVector.push_back(max*2/4);
375 greyValueColorsOfColorTransferenceFVector.push_back(max*3/4);
376 greyValueColorsOfColorTransferenceFVector.push_back(max*4/4);
378 _ctfun->AddRGBPoint( max*0/4 , 0.0, 0.0, 0.0);
379 _ctfun->AddRGBPoint( max*1/4 , 1.0, 0.0, 0.0);
380 _ctfun->AddRGBPoint( max*2/4 , 0.0, 0.0, 1.0);
381 _ctfun->AddRGBPoint( max*3/4 , 0.0, 1.0, 0.0);
382 _ctfun->AddRGBPoint( max*4/4 , 0.0, 0.2, 0.0);
384 _volumePlanes = vtkPlanes::New();
385 // int x1,x2,y1,y2,z1,z2;
386 // vtkImageData *imagedata=_vtkmprbasedata->GetImageData();
387 // imagedata->GetExtent(x1,x2,y1,y2,z1,z2);
388 // _volumePlanes->SetBounds(x1,x2,y1,y2,z1,z2);
392 // _volumeMapper = vtkVolumeRayCastMapper::New();
395 //EED 2017-01-01 Migration VTK7
396 #if VTK_MAJOR_VERSION <= 5
397 _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() );
399 _volumeMapper->SetInputData( this->GetVtkMPRBaseData()->GetImageData() );
403 _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
405 // _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
408 _volumeMapper->SetClippingPlanes( _volumePlanes );
409 _volumeMapper->AutoAdjustSampleDistancesOn();
411 _volumeProperty->SetInterpolationTypeToNearest();
412 //_volumeProperty = vtkVolumeProperty::New();
413 _volumeProperty->SetColor(_ctfun);
414 _volumeProperty->SetScalarOpacity( _tfun );
417 _volumeProperty->DisableGradientOpacityOn();
420 // _volumeProperty->SetInterpolationTypeToNearest();
421 // _volumeProperty->ShadeOff();
422 // _volumeProperty->SetAmbient(0.3);
423 // _volumeProperty->SetDiffuse(0.1);
424 // _volumeProperty->SetSpecular(0.8);
425 // _volumeProperty->DisableGradientOpacityOn();
427 // _newvol = vtkVolume::New();
428 _newvol->SetMapper(_volumeMapper );
429 _newvol->SetProperty(_volumeProperty );
431 _observerV = boxSurfaceObserver::New();
432 _observerV->SetPlanes( _volumePlanes );
433 _observerV->SetActor( _newvol );
434 _observerV->SetvtkVolumeRayCastMapper( _volumeMapper );
437 //-----------------------------------------------------------------------------
439 void vtkClipping3DDataViewer::Configure_VolumeBox()
441 _volumerendererdata->SetImageData(_vtkmprbasedata->GetImageData());
444 vector<double> *gv = this->GetGreyValuesTransferenceFVector();
445 vector<double> *op = this->GetIntensityValuesTransferenceFVector();
447 _volumerendererdata->SetLookUpTable((vtkLookupTable*)(_ctfun));
448 _volumerendererdata->OpacityChanged(*gv, *op);
450 //_wxvtkclipping3Dview->VisibleVolumeActor( false );
451 //_volumerendererdata->ShowVolume(event.IsChecked() );
452 //_volumerendererdata->BoundingBoxChanged(event.IsChecked() );
455 //-----------------------------------------------------------------------------
457 void vtkClipping3DDataViewer::SetRenderer(vtkRenderer* renderer)
459 _volumerendererdata->SetRenderer(renderer);
463 //-----------------------------------------------------------------------------
464 void vtkClipping3DDataViewer::SetInteractor(vtkRenderWindowInteractor* interactor)
467 _volumerendererdata->SetInteractor(interactor);
471 //-----------------------------------------------------------------------------
472 void vtkClipping3DDataViewer::BoxActorChanged(bool changed)
474 vector<double> *gv = this->GetGreyValuesTransferenceFVector();
475 vector<double> *op = this->GetIntensityValuesTransferenceFVector();
477 _volumerendererdata->ShowVolume(changed);
478 _volumerendererdata->OpacityChanged(*gv, *op);
479 _volumerendererdata->BoundingBoxChanged(changed);
483 //-----------------------------------------------------------------------------
484 void vtkClipping3DDataViewer::UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun)
486 _volumerendererdata->SetLookUpTable((vtkLookupTable*)(ctfun));
487 _volumerendererdata->OpacityChanged(gf, vf);
491 //-----------------------------------------------------------------------------
492 void vtkClipping3DDataViewer::updateVolume()
497 _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
498 _volumerendererdata->changeCompositeMIPFunction(0);
502 _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
503 _volumerendererdata->changeCompositeMIPFunction(1);
508 _volumeProperty->SetInterpolationTypeToLinear();
512 _volumeProperty->SetInterpolationTypeToNearest();
517 _volumeProperty->ShadeOn();
521 _volumeProperty->ShadeOff();
526 //-------------------------------------------------------------------
527 void vtkClipping3DDataViewer::Configure()
531 Configure_VolumeBox();
532 // An outline provides context around the data.
534 _outlineData = vtkOutlineFilter::New();
536 //EED 2017-01-01 Migration VTK7
537 #if VTK_MAJOR_VERSION <= 5
538 _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
540 _outlineData->SetInputData((vtkDataSet *) _vtkmprbasedata->GetImageData() );
543 _mapOutline = vtkPolyDataMapper::New();
545 //EED 4 nov 2015 Estelle
546 // _mapOutline->SetInput(_outlineData->GetOutput());
548 _outline = vtkActor::New();
549 _outline->SetMapper(_mapOutline);
550 _outline->GetProperty()->SetColor(0,0,0);
554 //-------------------------------------------------------------------
555 void vtkClipping3DDataViewer::SetIsovalue(int idTissue, int isoValue)
557 _mCubes[idTissue]->SetValue(0, isoValue);
559 //-------------------------------------------------------------------
560 double vtkClipping3DDataViewer::GetIsovalue(int idTissue)
562 return _mCubes[idTissue]->GetValue(0);
564 //-------------------------------------------------------------------
565 vtkVolume* vtkClipping3DDataViewer::GetVolumeActor()
569 //-------------------------------------------------------------------
570 vtkVolumeRayCastMapper* vtkClipping3DDataViewer::GetVolumeMapper(){
571 return _volumeMapper;
573 //-------------------------------------------------------------------
574 vtkPlanes* vtkClipping3DDataViewer::GetVolumePlanes()
576 return _volumePlanes;
579 //-------------------------------------------------------------------
580 vtkMarchingCubes *vtkClipping3DDataViewer::GetMCubes(int idTissue)
582 return _mCubes[idTissue];
584 //--------------------------------------------------------------------
585 //-------------------
587 //-------------------
589 std::vector<double>* vtkClipping3DDataViewer::GetGreyValuesTransferenceFVector()
591 return &greyValuesTransferenceFVector;
593 //--------------------------------------------------------------------
594 std::vector<double>* vtkClipping3DDataViewer::GetIntensityValuesTransferenceFVector()
596 return &intensityValuesTransferenceFVector;
598 //--------------------------------------------------------------------
599 std::vector<double>* vtkClipping3DDataViewer::GetRedColorsOfColorTransferenceFVector()
601 return &redColorsOfColorTransferenceFVector;
603 //--------------------------------------------------------------------
604 std::vector<double>* vtkClipping3DDataViewer::GetGreenColorsOfColorTransferenceFVector()
606 return &greenColorsOfColorTransferenceFVector;
608 //--------------------------------------------------------------------
609 std::vector<double>* vtkClipping3DDataViewer::GetBlueColorsOfColorTransferenceFVector()
611 return &blueColorsOfColorTransferenceFVector;
613 //--------------------------------------------------------------------
614 std::vector<double>* vtkClipping3DDataViewer::GetGreyValueColorsOfColorTransferenceFVector()
616 return &greyValueColorsOfColorTransferenceFVector;
618 //--------------------------------------------------------------------
619 //--------------------------------------
620 //Getters transference function
621 //and color of the transference function
622 //---------------------------------------
623 vtkPiecewiseFunction* vtkClipping3DDataViewer::GetTransferencefunction()
627 //--------------------------------------------------------------------
628 vtkColorTransferFunction* vtkClipping3DDataViewer::GetColorTransferenceFunction()
633 //-------------------------------------------------------------------
635 void vtkClipping3DDataViewer::ReadVolumeFunctions()
638 int i=0,xi,yi,r,g,b,gValue;
639 vtkImageData *imagedata = this->_vtkmprbasedata->GetImageData();
641 HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Histogram Dialog"),imagedata);
645 int tfSize=this->greyValuesTransferenceFVector.size();
649 hDlg->erasePointsTransferenceFunction();
652 double g=greyValuesTransferenceFVector[i];
653 double in=intensityValuesTransferenceFVector[i];
654 hDlg->addPointToTransferenceFunction(g,in*100);
660 int ctfSize=this->redColorsOfColorTransferenceFVector.size();
666 double gr=greyValueColorsOfColorTransferenceFVector[i];
667 double r=redColorsOfColorTransferenceFVector[i];
668 double g=greenColorsOfColorTransferenceFVector[i];
669 double b=blueColorsOfColorTransferenceFVector[i];
670 hDlg->addColorPoint(gr,r*255,g*255,b*255);
674 //If it is smooth activate next line
675 //hDlg->updatePlotter();
676 //setting variables if the user wants to do refresh
677 hDlg->setCTF(_ctfun);
681 // when the user had changed the transference Function
683 if(hDlg->ShowModal()== wxID_OK )
685 // -- vtkPiecewiseFunction --
686 this->_tfun->RemoveAllPoints();
687 greyValuesTransferenceFVector.clear();
688 intensityValuesTransferenceFVector.clear();
690 int nTFPoints=hDlg->getSizeTransferenceFunction();
694 hDlg->getTransferenceFunctionPoint(i,xi,yi);
695 this->_tfun->AddPoint( xi , yi/100.0 );
696 greyValuesTransferenceFVector.push_back(xi);
697 intensityValuesTransferenceFVector.push_back(yi/100.0);
700 // -- vtkColorTransferFunction --
701 this->_ctfun->RemoveAllPoints ();
703 redColorsOfColorTransferenceFVector.clear();
704 greenColorsOfColorTransferenceFVector.clear();
705 blueColorsOfColorTransferenceFVector.clear();
706 greyValueColorsOfColorTransferenceFVector.clear();
708 int nCTFpoints=hDlg->getSizeBarColor();
712 hDlg->getDataBarColorPoint(i,xi,r,g,b);
713 this->_ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 );
714 redColorsOfColorTransferenceFVector.push_back(r/255.0);
715 greenColorsOfColorTransferenceFVector.push_back(g/255.0);
716 blueColorsOfColorTransferenceFVector.push_back(b/255.0);
717 greyValueColorsOfColorTransferenceFVector.push_back(xi);
721 this->_volumeMapper->Update();
722 this->_newvol->Update();
728 if(hDlg->getRefreshed())
731 //--Transference Function----
732 this->_tfun->RemoveAllPoints();
734 size=greyValuesTransferenceFVector.size();
737 double grey1=greyValuesTransferenceFVector[i];
738 double in2=intensityValuesTransferenceFVector[i];
739 this->_tfun->AddPoint( grey1 , in2 );
742 // -- vtkColorTransferFunction --
743 _ctfun->RemoveAllPoints ();
746 size=greyValueColorsOfColorTransferenceFVector.size();
749 double grey2=(greyValueColorsOfColorTransferenceFVector)[i];
750 double red =(redColorsOfColorTransferenceFVector)[i];
751 double green =(greenColorsOfColorTransferenceFVector)[i];
752 double blue = (blueColorsOfColorTransferenceFVector)[i];
753 _ctfun->AddRGBPoint(grey2,red,green,blue);
755 this->_volumeMapper->Update();
756 this->_newvol->Update();
764 void vtkClipping3DDataViewer::ReadVolumeFunctions(char *namefile)
771 FILE *ff = fopen ( namefile ,"r");
775 if (strcmp(tmp,"MAX")==0)
777 vtkImageData *vtkimagedata = this->_vtkmprbasedata->GetImageData();
778 vtkimagedata->GetScalarRange(range);
779 max = (int) (range[1]);
784 fscanf(ff,"%s",tmp); // --
786 // -- vtkPiecewiseFunction --
787 this->_tfun->RemoveAllPoints();
789 while ( strcmp(tmp,"--")!=0 )
794 this->_tfun->AddPoint( x*max , val );
798 this->_ctfun->RemoveAllPoints ();
799 // -- vtkColorTransferFunction --
810 this->_ctfun->AddRGBPoint( x*max , r,g,b );
814 this->_volumeMapper->Update();
815 this->_newvol->Update();
822 //-------------------------------------------------------------------
824 void vtkClipping3DDataViewer::ReadMeshVTK(char *namefile)
826 vtkDataSetReader *reader = vtkDataSetReader::New();
827 reader->SetFileName(namefile);
830 //EED 2017-01-01 Migration VTK7
831 #if VTK_MAJOR_VERSION <= 5
832 _tissueStripper[3]->SetInput( reader->GetPolyDataOutput() );
834 _tissueStripper[3]->SetInputData( reader->GetPolyDataOutput() );
839 void vtkClipping3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){
841 _volumeProperty->SetColor(colortable);
846 void vtkClipping3DDataViewer::SetRayCasting(bool active)
848 _isRayCasting = active;
852 void vtkClipping3DDataViewer::SetMIPActive(bool active)
857 void vtkClipping3DDataViewer::SetInterpolation(bool active)
859 _interpolation = active;
862 void vtkClipping3DDataViewer::SetShade(bool active)