_representationType[i] = true;
}
_visibleVolume=false;
+ _isRayCasting=true;
+ _isMIP=false;
+ _interpolation=false;
+ _shade=false;
+
+ _volumeMapper = vtkVolumeRayCastMapper::New();
+ _newvol = vtkVolume::New();
+ _volumeProperty = vtkVolumeProperty::New();
}
//-------------------------------------------------------------------
vtkClipping3DDataViewer::~vtkClipping3DDataViewer()
// _newvol->VisibilityOn();
-
+
// _volumeMapper = vtkVolumeRayCastMapper::New();
// _volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() );
// _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
_tissuePlanes[i] = vtkPlanes::New();
-
+
int x1,x2,y1,y2,z1,z2;
imagedata->GetExtent(x1,x2,y1,y2,z1,z2);
_tissuePlanes[i]->SetBounds (x1,x2,y1,y2,z1,z2);
-
+
_tissueClipper[i] = vtkClipPolyData::New();
_tissueClipper[i]->SetInput( _tissueStripper[i]->GetOutput() );
_tissueClipper[i]->SetClipFunction( _tissuePlanes[i] );
// _tissueMapper[i]->Update();
}
-
+
// vtkActor tissue
{
// Volume
+
+
+ /** if(_newvol != NULL)
+ {
+ _newvol->Delete();
+ _volumeMapper->Delete();
+ _volumeProperty->Delete();
+ }*/
+
+
+
_tfun = vtkPiecewiseFunction::New();
_ctfun = vtkColorTransferFunction::New();
_tfun->AddPoint(max * 2/2 , 1.0);
/*
- Adding the colors to the vectors
+ Adding the colors to the vectors
*/
//RED
redColorsOfColorTransferenceFVector.push_back(0.0);
greenColorsOfColorTransferenceFVector.push_back(0.0);
greenColorsOfColorTransferenceFVector.push_back(1.0);
greenColorsOfColorTransferenceFVector.push_back(0.2);
-
+
//BLUE
blueColorsOfColorTransferenceFVector.push_back(0.0);
blueColorsOfColorTransferenceFVector.push_back(0.0);
blueColorsOfColorTransferenceFVector.push_back(1.0);
blueColorsOfColorTransferenceFVector.push_back(0.0);
blueColorsOfColorTransferenceFVector.push_back(0.0);
- //GREY VALUE
+ //GREY VALUE
greyValueColorsOfColorTransferenceFVector.push_back(max*0/4);
greyValueColorsOfColorTransferenceFVector.push_back(max*1/4);
greyValueColorsOfColorTransferenceFVector.push_back(max*2/4);
// _volumePlanes->SetBounds(x1,x2,y1,y2,z1,z2);
// EED 13/03/2011
-
+
_compositeFunction = vtkVolumeRayCastCompositeFunction::New();
vtkVolumeRayCastMIPFunction* _compositeFunctionMIP = vtkVolumeRayCastMIPFunction::New();
- _volumeMapper = vtkVolumeRayCastMapper::New();
+ // _volumeMapper = vtkVolumeRayCastMapper::New();
_volumeMapper->SetInput( this->GetVtkMPRBaseData()->GetImageData() );
-
- _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
-// _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
-
+
+if(_isRayCasting)
+{
+ cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isRayCasting"<<endl;
+ _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
+
+}
+else if(_isMIP)
+{
+ cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isMIP"<<endl;
+ _volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
+}
+
+//
+
_volumeMapper->SetClippingPlanes( _volumePlanes );
_volumeMapper->AutoAdjustSampleDistancesOn();
- _volumeProperty = vtkVolumeProperty::New();
+ //_volumeProperty = vtkVolumeProperty::New();
_volumeProperty->SetColor(_ctfun);
_volumeProperty->SetScalarOpacity( _tfun );
// EED 31/03/2008
-
+
_volumeProperty->DisableGradientOpacityOn();
-
- _volumeProperty->SetInterpolationTypeToLinear();
-// _volumeProperty->SetInterpolationTypeToNearest();
-
- _volumeProperty->ShadeOn();
-// _volumeProperty->ShadeOff();
-
-
+
+if(_interpolation)
+{
+ _volumeProperty->SetInterpolationTypeToLinear();
+}
+else
+{
+ _volumeProperty->SetInterpolationTypeToNearest();
+}
+
+if(_shade)
+{
+ _volumeProperty->ShadeOn();
+}
+else
+{
+ _volumeProperty->ShadeOff();
+}
+
+// _
+
+
+// _
+
+
// _volumeProperty->SetInterpolationTypeToNearest();
// _volumeProperty->ShadeOff();
// _volumeProperty->SetAmbient(0.3);
// _volumeProperty->SetSpecular(0.8);
// _volumeProperty->DisableGradientOpacityOn();
- _newvol = vtkVolume::New();
+ // _newvol = vtkVolume::New();
_newvol->SetMapper(_volumeMapper );
_newvol->SetProperty(_volumeProperty );
}
//--------------------------------------------------------------------
std::vector<double>* vtkClipping3DDataViewer::GetBlueColorsOfColorTransferenceFVector()
-{
+{
return &blueColorsOfColorTransferenceFVector;
}
//--------------------------------------------------------------------
/*
int i=0,xi,yi,r,g,b,gValue;
vtkImageData *imagedata = this->_vtkmprbasedata->GetImageData();
-
+
HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Histogram Dialog"),imagedata);
- //
+ //
// put in a method
//
int tfSize=this->greyValuesTransferenceFVector.size();
hDlg->addPointToTransferenceFunction(g,in*100);
i++;
}
-
+
}
int ctfSize=this->redColorsOfColorTransferenceFVector.size();
//setting variables if the user wants to do refresh
hDlg->setCTF(_ctfun);
hDlg->setTF(_tfun);
-
+
//
// when the user had changed the transference Function
//
if(hDlg->ShowModal()== wxID_OK )
- {
+ {
// -- vtkPiecewiseFunction --
this->_tfun->RemoveAllPoints();
greyValuesTransferenceFVector.clear();
intensityValuesTransferenceFVector.clear();
-
+
int nTFPoints=hDlg->getSizeTransferenceFunction();
i=0;
while(i<nTFPoints)
greyValuesTransferenceFVector.push_back(xi);
intensityValuesTransferenceFVector.push_back(yi/100.0);
i++;
- }
+ }
// -- vtkColorTransferFunction --
this->_ctfun->RemoveAllPoints ();
//clean colors
greyValueColorsOfColorTransferenceFVector.clear();
int nCTFpoints=hDlg->getSizeBarColor();
- i=0;
+ i=0;
while(i<nCTFpoints)
{
hDlg->getDataBarColorPoint(i,xi,r,g,b);
greyValueColorsOfColorTransferenceFVector.push_back(xi);
i++;
}
-
+
this->_volumeMapper->Update();
this->_newvol->Update();
}
-
+
else
{
-
+
if(hDlg->getRefreshed())
{
int i=0,size;
double in2=intensityValuesTransferenceFVector[i];
this->_tfun->AddPoint( grey1 , in2 );
}
-
+
// -- vtkColorTransferFunction --
_ctfun->RemoveAllPoints ();
-
+
i=0;
- size=greyValueColorsOfColorTransferenceFVector.size();
+ size=greyValueColorsOfColorTransferenceFVector.size();
for(i=0;i<size;i++)
{
double grey2=(greyValueColorsOfColorTransferenceFVector)[i];
this->_volumeMapper->Update();
this->_newvol->Update();
}
-
+
}
hDlg->Destroy();
*/
// -- vtkPiecewiseFunction --
this->_tfun->RemoveAllPoints();
- fscanf(ff,"%s",tmp);
+ fscanf(ff,"%s",tmp);
while ( strcmp(tmp,"--")!=0 )
{
x=atof(tmp);
- fscanf(ff,"%s",tmp);
+ fscanf(ff,"%s",tmp);
val=atof(tmp);
this->_tfun->AddPoint( x*max , val );
- fscanf(ff,"%s",tmp);
+ fscanf(ff,"%s",tmp);
}
this->_ctfun->RemoveAllPoints ();
// -- vtkColorTransferFunction --
while ( !feof(ff))
{
- fscanf(ff,"%s",tmp);
+ fscanf(ff,"%s",tmp);
x=atof(tmp);
- fscanf(ff,"%s",tmp);
+ fscanf(ff,"%s",tmp);
r=atof(tmp);
- fscanf(ff,"%s",tmp);
+ fscanf(ff,"%s",tmp);
g=atof(tmp);
- fscanf(ff,"%s",tmp);
+ fscanf(ff,"%s",tmp);
b=atof(tmp);
- this->_ctfun->AddRGBPoint( x*max , r,g,b );
+ this->_ctfun->AddRGBPoint( x*max , r,g,b );
}
}
void vtkClipping3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){
-
+
_volumeProperty->SetColor(colortable);
-
+
+}
+
+
+void vtkClipping3DDataViewer::SetRayCasting(bool active)
+{
+ _isRayCasting = active;
+
+}
+
+void vtkClipping3DDataViewer::SetMIPActive(bool active)
+{
+ _isMIP = active;
+}
+
+void vtkClipping3DDataViewer::SetInterpolation(bool active)
+{
+ _interpolation = active;
}
+
+void vtkClipping3DDataViewer::SetShade(bool active)
+{
+ _shade = active;
+}
+
boxSurfaceObserver *GetObserverS(int idObserverS);
boxSurfaceObserver *GetObserverV();
- //void ReadVolumeFunctions(char *namefile);
- void ReadVolumeFunctions();
- void ReadMeshVTK(char *namefile);
+ //void ReadVolumeFunctions(char *namefile);
+ void ReadVolumeFunctions();
+ void ReadMeshVTK(char *namefile);
//-------------------
vtkPiecewiseFunction *GetTransferencefunction();
vtkColorTransferFunction *GetColorTransferenceFunction();
+ void SetRayCasting(bool active);
+ void SetMIPActive(bool active);
+ void SetInterpolation(bool active);
+ void SetShade(bool active);
+
private:
-
+
vtkMarchingCubes *_mCubes[ VTKMPRDATA_MAXTISSUE ];
vtkStripper *_tissueStripper[ VTKMPRDATA_MAXTISSUE ];
vtkPolyDataMapper *_tissueMapper[ VTKMPRDATA_MAXTISSUE ];
std::vector<double> greenColorsOfColorTransferenceFVector;
std::vector<double> blueColorsOfColorTransferenceFVector;
std::vector<double> greyValueColorsOfColorTransferenceFVector;
+
+ bool _isRayCasting;
+ bool _isMIP;
+ bool _interpolation;
+ bool _shade;
};
#endif /*VTKCLIPPING3DDATAVIEWER_H_*/
//-------------------------------------------------------------------
vtkClipping3DDataViewer* wxVtkClipping3DView::GetVtkClipping3DDataViewer()
{
- return _vtkclipping3Ddataviewer;
+ return _vtkclipping3Ddataviewer;
}
//-------------------------------------------------------------------
void wxVtkClipping3DView::VisibleActor(int idTissue, bool visTissue){
if (visTissue!=_vtkclipping3Ddataviewer->GetVisibleTissue(idTissue)){
if (visTissue==false){
- _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkclipping3Ddataviewer->GetTissueActor(idTissue) );
+ _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkclipping3Ddataviewer->GetTissueActor(idTissue) );
} else {
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(idTissue) );
+ _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(idTissue) );
// _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(idTissue) );
// _actor->VisibilityOn();
}
void wxVtkClipping3DView::VisibleVolumeActor( bool visVolume){
if (visVolume!=_vtkclipping3Ddataviewer->GetVisibleVolume() ){
if (visVolume==false){
-//EED 31/03/2008
-// _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkclipping3Ddataviewer->GetVolumeActor() );
- _wxvtk3Dbaseview->GetRenderer()->RemoveVolume( _vtkclipping3Ddataviewer->GetVolumeActor() );
+//EED 31/03/2008
+// _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkclipping3Ddataviewer->GetVolumeActor() );
+ _wxvtk3Dbaseview->GetRenderer()->RemoveVolume( _vtkclipping3Ddataviewer->GetVolumeActor() );
} else {
-//EED 31/03/2008
-// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetVolumeActor() );
- _wxvtk3Dbaseview->GetRenderer()->AddVolume( _vtkclipping3Ddataviewer->GetVolumeActor() );
+//EED 31/03/2008
+// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetVolumeActor() );
+ _wxvtk3Dbaseview->GetRenderer()->AddVolume( _vtkclipping3Ddataviewer->GetVolumeActor() );
}
_vtkclipping3Ddataviewer->SetVisibleVolume(visVolume);
}
void wxVtkClipping3DView::Configure(){
_wxvtk3Dbaseview->Configure();
- // Actors are added to the renderer.
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetOutlineActor() );
+ // Actors are added to the renderer.
+ _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetOutlineActor() );
_boxWidgetS1 = vtkBoxWidget::New();
_boxWidgetS1->SetInteractor( _wxvtk3Dbaseview->GetWxVTKRenderWindowInteractor() );
vtkStripper *stripper=_vtkclipping3Ddataviewer->GetTissueStripper(0);
vtkPolyData *polydata= stripper->GetOutput();
-
+
_boxWidgetS1->SetInput( polydata );
_boxWidgetS1->PlaceWidget();
-// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(0) );
-// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(3));
+// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(0) );
+// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(3));
VisibleActor(0, false );
VisibleActor(1, false );
VisibleActor(3, false );
_boxWidgetS1->HandlesOn ();
-
-//EED 29Mars2009
+
+//EED 29Mars2009
// _boxWidgetS1->On();
-
+
_boxWidgetS1->Off();
_boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(0) );
_boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(1) );
_boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(2) );
_boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(3) );
-
+
// EED 9 fev 2007
// box Volume
_boxWidgetVolume = vtkBoxWidget::New();
_boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent , _vtkclipping3Ddataviewer->GetObserverV() );
_boxWidgetVolume->HandlesOn ();
-
-//EED 29Mars2009
+
+//EED 29Mars2009
// _boxWidgetVolume->On();
-
+
_boxWidgetVolume->Off();
// _boxWidgetVolume->GetPlanes( vtkplanes );
- // An initial camera view is created. The Dolly() method moves
+ // An initial camera view is created. The Dolly() method moves
// the camera towards the FocalPoint, thereby enlarging the image.
_wxvtk3Dbaseview->GetRenderer()->SetActiveCamera(_wxvtk3Dbaseview->GetCamera());
_wxvtk3Dbaseview->GetRenderer()->ResetCamera ();
// Note that when camera movement occurs (as it does in the Dolly()
// method), the clipping planes often need adjusting. Clipping planes
- // consist of two planes: near and far along the view direction. The
+ // consist of two planes: near and far along the view direction. The
// near plane clips out objects in front of the plane; the far plane
// clips out objects behind the plane. This way only what is drawn
// between the planes is actually rendered.
{
_vtkclipping3Ddataviewer = vtkclipping3Ddataviewer;
}
+
+void wxVtkClipping3DView::SetRayCasting(bool active)
+{
+ _vtkclipping3Ddataviewer->SetRayCasting(active);
+ _vtkclipping3Ddataviewer->Configure();
+}
+
+void wxVtkClipping3DView::SetMIPActive(bool active)
+{
+ _vtkclipping3Ddataviewer->SetMIPActive(active);
+ _vtkclipping3Ddataviewer->Configure();
+}
+
+void wxVtkClipping3DView::SetInterpolation(bool active)
+{
+ _vtkclipping3Ddataviewer->SetInterpolation(active);
+ _vtkclipping3Ddataviewer->Configure();
+}
+
+void wxVtkClipping3DView::SetShade(bool active)
+{
+ _vtkclipping3Ddataviewer->SetShade(active);
+ _vtkclipping3Ddataviewer->Configure();
+}
+
+
wxPanel* CreateSurfControlPanel(wxWindow *parent);
wxPanel* CreateVolControlPanel(wxWindow *parent);
-
+
vtkClipping3DDataViewer* GetVtkClipping3DDataViewer();
void VisibleActor(int idTissue, bool visTissue);
wxVtk3DBaseView* GetWxvtk3Dbaseview()throw(char*);
+ void SetRayCasting(bool active);
+ void SetMIPActive(bool active);
+ void SetInterpolation(bool active);
+ void SetShade(bool active);
+
+
private:
wxVtk3DBaseView *_wxvtk3Dbaseview;
vtkClipping3DDataViewer *_vtkclipping3Ddataviewer;
_wxvtkclipping3Dview = wxvtkclipping3Dview;
- wxCheckBox *ckVolum = new wxCheckBox(panel,-1,_T("Vol"));
+ wxCheckBox *ckVolum = new wxCheckBox(panel,-1,_T("Volume"));
wxCheckBox *ckBoxVolume = new wxCheckBox(panel,-1,_T("Volume Box"));
+ ckBoxVolume->Disable();
+
+ rbRayCasting = new wxRadioButton(panel, -1, _T("Ray Casting"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
+ rbMIP = new wxRadioButton(panel, -1, _T("MIP"));
+
+ ckInterpolation = new wxCheckBox(panel, -1, _T("Interpolation"));
+ ckShade = new wxCheckBox(panel, -1, _T("Shade"));
+
+ rbRayCasting->Disable();
+ rbMIP->Disable();
+ ckInterpolation->Disable();
+ ckShade->Disable();
+
+
wxButton *btnVolumeFunctions = new wxButton(panel,-1,_T("Read Volume Functions"));
- Connect(btnVolumeFunctions->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions );
+ Connect(btnVolumeFunctions->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions );
ckBoxVolume->SetValue(false);
Connect(ckVolum->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnVisibleVolume );
Connect(ckBoxVolume->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnVisibleBoxVolume );
+ Connect(rbRayCasting->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnRayCastingActive );
+ Connect(rbMIP->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnMIPActive );
+
+ Connect(ckInterpolation->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnInterpolationActive );
+ Connect(ckShade->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewVolCntrlPanel::OnShadeActive );
+
+
+
wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
wxFlexGridSizer *sizerH0 = new wxFlexGridSizer(20);
+ wxFlexGridSizer *sizerH1 = new wxFlexGridSizer(20);
+ wxFlexGridSizer *sizerH2 = new wxFlexGridSizer(20);
sizerH0->Add( ckVolum , 1, wxALL|wxEXPAND, 0);
sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
sizerH0->Add( btnVolumeFunctions , 1, wxALL|wxEXPAND, 0);
+ sizerH1->Add(rbRayCasting, 1, wxALL|wxEXPAND, 0 );
+ sizerH1->Add(rbMIP, 1, wxALL|wxEXPAND, 0 );
+
+ sizerH2->Add(ckInterpolation, 1, wxALL|wxEXPAND, 0 );
+ sizerH2->Add(ckShade, 1, wxALL|wxEXPAND, 0 );
+
sizer->Add( sizerH0 , 1, wxALL|wxEXPAND, 2);
+ sizer->Add( sizerH1 , 1, wxALL|wxEXPAND, 2);
+ sizer->Add( sizerH2 , 1, wxALL|wxEXPAND, 2);
panel->SetSize(300,60);
panel->SetAutoLayout(true);
//-------------------------------------------------------------------
void wxVtkClipping3DViewVolCntrlPanel::OnVisibleVolume(wxCommandEvent& event)
{
+ cout<<"JPRG::wxVtkClipping3DViewVolCntrlPanel::OnVisibleVolume::event_value::"<<event.IsChecked()<<endl;
_wxvtkclipping3Dview->VisibleVolumeActor( event.IsChecked() );
+ if(event.IsChecked())
+ {
+ rbRayCasting->Enable();
+ rbMIP->Enable();
+ ckInterpolation->Enable();
+ ckShade->Enable();
+ }
+ else
+ {
+ rbRayCasting->Disable();
+ rbMIP->Disable();
+ ckInterpolation->Disable();
+ ckShade->Disable();
+ }
_wxvtkclipping3Dview->Refresh();
wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
//-------------------------------------------------------------------
void wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
{
-
+
int /*i=0,*/ xi,yi,r,g,b; // JPRx
vtkColorTransferFunction* ctfun = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetColorTransferenceFunction();
vtkPiecewiseFunction* tfun = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTransferencefunction();
*/
/*
- MMLR BORRAME
+ MMLR BORRAME
wxFileDialog dialog(this, _T("Choose a file"), _T("c:/Maracas_configuration"),_T(""), _T("*.MarVolConf"), wxOPEN);
if (dialog.ShowModal() == wxID_OK)
{
_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions( (char *)dialog.GetPath().c_str() );
-
-
+
+
}
*/
HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Histogram Dialog"),imagedata,1);
- //
+ //
// put in a method
//
int tfSize=gtf->size();
hDlg->addPointToTransferenceFunction(g,in*100);
i++;
}
-
+
}
int ctfSize=rctf->size();
// when the user had changed the transference Function
//
if(hDlg->ShowModal()== wxID_OK )
- {
+ {
// -- vtkPiecewiseFunction --
tfun->RemoveAllPoints();
gtf->clear();
itf->clear();
-
+
int nTFPoints=hDlg->getSizeTransferenceFunction();
int i=0;
while(i<nTFPoints)
gtf->push_back(xi);
itf->push_back(yi/100.0);
i++;
- }
+ }
// -- vtkColorTransferFunction --
ctfun->RemoveAllPoints ();
//clean colors
greyctf->clear();
int nCTFpoints=hDlg->getSizeBarColor();
- i=0;
+ i=0;
while(i<nCTFpoints)
{
hDlg->getDataBarColorPoint(i,xi,r,g,b);
_wxvtkclipping3Dview->Refresh();
wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
_wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
-
+
/*
volumeMapper->Update();
newvol->Update();
double in2=(*itf)[i];
tfun->AddPoint( grey1 , in2 );
}
-
+
// -- vtkColorTransferFunction --
ctfun->RemoveAllPoints ();
-
+
i=0;
- size=greyctf->size();
+ size=greyctf->size();
for(i=0;i<size;i++)
{
double grey2=(*greyctf)[i];
double blue = (*bctf)[i];
ctfun->AddRGBPoint(grey2,red,green,blue);
}
-
+
//---------------------------------
// Refreshing and sending the event
//---------------------------------
_wxvtkclipping3Dview->Refresh();
wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
_wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
-
+
/*
volumeMapper->Update();
newvol->Update();
*/
}
-
+
}
//destroy the dialog
hDlg->Destroy();
}
+
+void wxVtkClipping3DViewVolCntrlPanel::OnRayCastingActive(wxCommandEvent& event){
+ //If Ray Casting is active, others options are disabled. Only RayCasting is true
+ _wxvtkclipping3Dview->SetRayCasting(true);
+ _wxvtkclipping3Dview->SetMIPActive(false);
+ _wxvtkclipping3Dview->Refresh();
+}
+
+void wxVtkClipping3DViewVolCntrlPanel::OnMIPActive(wxCommandEvent& event){
+ //If MIP is active, others options are disabled. Only MIP is true
+ _wxvtkclipping3Dview->SetMIPActive(true);
+ _wxvtkclipping3Dview->SetRayCasting(false);
+
+ _wxvtkclipping3Dview->Refresh();
+}
+
+
+
+void wxVtkClipping3DViewVolCntrlPanel::OnInterpolationActive(wxCommandEvent& event){
+ _wxvtkclipping3Dview->SetInterpolation(event.IsChecked());
+ _wxvtkclipping3Dview->Refresh();
+}
+
+void wxVtkClipping3DViewVolCntrlPanel::OnShadeActive(wxCommandEvent& event){
+ _wxvtkclipping3Dview->SetShade(event.IsChecked());
+ _wxvtkclipping3Dview->Refresh();
+}
+
public:
wxVtkClipping3DViewVolCntrlPanel(wxWindow *parent, wxVtkClipping3DView *_wxvtkclipping3Dview);
~wxVtkClipping3DViewVolCntrlPanel();
-
+
void OnVisibleVolume(wxCommandEvent& event);
void OnVisibleBoxVolume(wxCommandEvent& event);
virtual void Refresh();
void OnBtnVolumeFunctions(wxCommandEvent& event);
+ void OnRayCastingActive(wxCommandEvent& event);
+ void OnMIPActive(wxCommandEvent& event);
+ void OnInterpolationActive(wxCommandEvent& event);
+ void OnShadeActive(wxCommandEvent& event);
private:
wxVtkClipping3DView *_wxvtkclipping3Dview;
+ wxRadioButton *rbRayCasting;
+ wxRadioButton *rbMIP;
+ wxCheckBox *ckInterpolation;
+ wxCheckBox *ckShade;
protected: