#JCP 31-05-11
ADD_SUBDIRECTORY(GUI)
ADD_SUBDIRECTORY(Kernel)
+ADD_SUBDIRECTORY(itkToVtk)
#include "volumerendererdata.h"
+#include "vtkObjectFactory.h"
+
+vtkCxxRevisionMacro(VolumeRendererData, "$Revision: 1.4 $");
+vtkStandardNewMacro(VolumeRendererData);
VolumeRendererData::VolumeRendererData()
{
void VolumeRendererData::ShowVolume(bool checked){
if(checked){
- invariant();
+ // invariant();
+ cout<<"JPRG::VolumeRendererData::ShowVolume"<<endl;
VolRendData = new VolumeRendererManagerData(ImageData, true);
- if(!LookUpTable){
-
- }else{
- VolRendData->SetLookupTable(LookUpTable);
- }
+ VolRendData->SetLookupTable(LookUpTable);
Renderer->AddActor(VolRendData->getProp3D());
}else{
Renderer->RemoveActor(VolRendData->getProp3D());
}
}
void VolumeRendererData::OpacityChanged(vector<double> greyvalues, vector<double> values){
- invariant();
- if(VolRendData){
- VolRendData->setVolumeOpacity(greyvalues,values);
+ //invariant();
+
+ if(VolRendData==NULL)
+ {
+ VolRendData = new VolumeRendererManagerData(ImageData, true);
+
}
+ VolRendData->SetLookupTable(LookUpTable);
+ VolRendData->setVolumeOpacity(greyvalues,values);
+
}
+
void VolumeRendererData::BoundingBoxChanged(bool checked){
- invariant();
+ // invariant();
+
+ if(VolRendData==NULL)
+ {
+ VolRendData = new VolumeRendererManagerData(ImageData, true);
+ VolRendData->SetLookupTable(LookUpTable);
+ }
+
+
if(VolRendData && Interactor){
if(checked){
VolRendData->EnableBoundingBox(Interactor);
class VolumeRendererData : public vtkObject
{
public:
- VolumeRendererData();
+ static VolumeRendererData *New();
+ vtkTypeRevisionMacro(VolumeRendererData,vtkObject);
+ //
- vtkSetObjectMacro(VolRendData, VolumeRendererManagerData)
vtkSetObjectMacro(ImageData, vtkImageData)
vtkSetObjectMacro(Renderer, vtkRenderer)
vtkSetObjectMacro(LookUpTable, vtkLookupTable)
vtkSetObjectMacro(Interactor, vtkRenderWindowInteractor)
+ void BoundingBoxChanged(bool checked);
+ void ShowVolume(bool enable);
+ void OpacityChanged(vector<double> greyvalues, vector<double> values);
+
+ void changeCompositeMIPFunction(int function);
+
protected:
+ VolumeRendererData();
VolumeRendererManagerData* VolRendData;
vtkImageData* ImageData;
vtkRenderer* Renderer;
vtkLookupTable* LookUpTable;
vtkRenderWindowInteractor* Interactor;
- void ShowVolume(bool enable);
- void OpacityChanged(vector<double> greyvalues, vector<double> values);
- void BoundingBoxChanged(bool checked);
- void changeCompositeMIPFunction(int function);
+
+
+
private:
{
_propid = propid;
isComplexBox = _isComplexBox;
-
+
createControls(img);
}
/**
** Class destructor
**/
-wxMaracasMultipleVolumeRendererPanel::~wxMaracasMultipleVolumeRendererPanel(){
-
+wxMaracasMultipleVolumeRendererPanel::~wxMaracasMultipleVolumeRendererPanel(){
+
//if(isComplexBox)
//((wxMaracasRenderTabbedPanel*)(wxMaracasRendererView::getInstance())->getTabbedPanel())->deleteVolume(_propid);
//else
void wxMaracasMultipleVolumeRendererPanel::createControls(vtkImageData* img){
wxFlexGridSizer* sizerirmprop = new wxFlexGridSizer(3);
-
+
if(!isComplexBox)
{
-// wxStaticText* label = new wxStaticText(this, -1, wxString(_T("")));
+// wxStaticText* label = new wxStaticText(this, -1, wxString(_T("")));
// wxStaticText* label2 = new wxStaticText(this, -1, wxString(_T("")));
checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor")));
- Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onCheckBoxChange);
- checkbox->SetValue(true);
+ Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onCheckBoxChange);
+ checkbox->SetValue(true);
wxString choices[] = {_T("Composite"), _T("MIP")};
_radiobox = new wxRadioBox(this, -1, wxString(_T("Function")), wxDefaultPosition, wxDefaultSize, 2, choices);
//sizerirmprop->Add(label2,wxFIXED_MINSIZE);
}
//wxBitmap bitmap(Color_xpm);
- //_colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30));
- //Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onColorChange);
+ //_colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30));
+ //Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onColorChange);
mwxwidget = new HistogramDialogComboBox(this);
mwxwidget->setImageData(img);
//mwxwidget->PushEventHandler(this);
Connect(mwxwidget->GetId(), wxEVT_COMMAND_COMBOBOX_SELECTED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onColorChange);
- sizerirmprop->Add(mwxwidget,wxFIXED_MINSIZE);
+ sizerirmprop->Add(mwxwidget,wxFIXED_MINSIZE);
wxBitmap bitmap0(Add_xpm);
- _viewimage = new wxBitmapButton(this, -1, bitmap0, wxDefaultPosition, wxSize(30,30));
- Connect(_viewimage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onViewImage);
- sizerirmprop->Add(_viewimage,wxFIXED_MINSIZE);
+ _viewimage = new wxBitmapButton(this, -1, bitmap0, wxDefaultPosition, wxSize(30,30));
+ Connect(_viewimage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onViewImage);
+ sizerirmprop->Add(_viewimage,wxFIXED_MINSIZE);
//std::string iconsdir = wxMaracasMultipleVolumeRendererView::getInstance()->getPath();
//iconsdir+="/data/Icons/Add.xmp";
//wxBitmap* bitmap = new wxBitmap(wxString(iconsdir.c_str(),wxConvUTF8), wxBITMAP_TYPE_XPM);
- this->SetSizer(sizerirmprop, true);
+ this->SetSizer(sizerirmprop, true);
this->SetAutoLayout( true );
-
- //_frame = new wxFrame(this, 10, _T("Configure Transfer Functions"));
+
+ //_frame = new wxFrame(this, 10, _T("Configure Transfer Functions"));
/*wxButton* button1 = new wxButton(_frame,20,_T("OK"));
- Connect(button1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onOK);
+ Connect(button1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onOK);
wxButton* button2 = new wxButton(_frame,30,_T("Cancel") );
- Connect(button2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onCancel);
+ Connect(button2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onCancel);
wxButton* button3 = new wxButton(_frame,40,_T("Update"));
Connect(button3->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onUpdate); */
img->GetScalarRange(range);
double max = range[1];
-
+
//X
mwxwidget->addPointToTransferenceFunction(max * 0/2,0.0);
mwxwidget->addPointToTransferenceFunction(max * 1/2,100.0);
boxSizer->Add(button3, wxCENTER);
wxBoxSizer* boxsizer2 = new wxBoxSizer(wxVERTICAL);
- boxsizer2->Add(boxSizer0,1,wxEXPAND);
- boxsizer2->Add(boxSizer,0,wxCENTER);
-
+ boxsizer2->Add(boxSizer0,1,wxEXPAND);
+ boxsizer2->Add(boxSizer,0,wxCENTER);
+
_frame->SetAutoLayout(true);
_frame->SetSizer(boxsizer2);
_frame->Refresh();
- _frame->Update();*/
+ _frame->Update();*/
//mwxwidget->SetFunctions(wxMaracasMultipleVolumeRendererView::getInstance()->GetTransferFunction(getPropId()),
// wxMaracasMultipleVolumeRendererView::getInstance()->GetColorFunction(getPropId()));
- mwxwidget->Refresh();
+ mwxwidget->Refresh();
}
/**
**
**/
void wxMaracasMultipleVolumeRendererPanel::onUpdate(wxCommandEvent& event){
- updateVolume();
+ updateVolume();
}
/**
( (wxMaracasRendererView::getInstance())->getTabbedPanel(this->_propid) )->SetValuesPointsFunction(this->_propid, greylevel, values);
}
else
- {
+ {
wxMaracasMultipleVolumeRendererView::getInstance()->SetValuesColorPointsFunction(this->_propid, greylevelcolors, red, green, blue);
wxMaracasMultipleVolumeRendererView::getInstance()->SetValuesPointsFunction(this->_propid, greylevel, values);
}
/**
** Updates the volume visualization
**/
-void wxMaracasMultipleVolumeRendererPanel::onColorChange(wxCommandEvent& event){
+void wxMaracasMultipleVolumeRendererPanel::onColorChange(wxCommandEvent& event){
//if(mwxwidget->ShowModal()==wxID_OK){
updateVolume();
// mwxwidget->Show(false);
- //}
+ //}
}
/**
**
**/
void wxMaracasMultipleVolumeRendererPanel::onViewImage(wxCommandEvent& event)
-{
+{
vtkImageData* img;
std::vector<int> type;
type.push_back(6);
if(this->isComplexBox)
{
- img = (wxMaracasRendererView::getInstance())->getTabbedPanel(_propid)->getVolImage();
+ img = (wxMaracasRendererView::getInstance())->getTabbedPanel(_propid)->getVolImage();
}
else
- {
+ {
img = wxMaracasMultipleVolumeRendererView::getInstance()->getVolumeRenderManager()->getImageData();
}
/**
**
**/
-void wxMaracasMultipleVolumeRendererPanel::onCheckBoxChange(wxCommandEvent& event){
+void wxMaracasMultipleVolumeRendererPanel::onCheckBoxChange(wxCommandEvent& event){
if(this->isComplexBox)
( (wxMaracasRendererView::getInstance())->getTabbedPanel(this->_propid) )->addRemoveActorV(this->getPropId(), checkbox->GetValue());
else
- wxMaracasMultipleVolumeRendererView::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
+ wxMaracasMultipleVolumeRendererView::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
}
/**
return _propid;
}
-void wxMaracasMultipleVolumeRendererPanel::onRadioBoxSelectFunction(wxCommandEvent& event){
-
- wxMaracasMultipleVolumeRendererView::getInstance()->changeCompositeMIPFunction(this->getPropId(), _radiobox->GetSelection());
+void wxMaracasMultipleVolumeRendererPanel::onRadioBoxSelectFunction(wxCommandEvent& event){
+
+ wxMaracasMultipleVolumeRendererView::getInstance()->changeCompositeMIPFunction(this->getPropId(), _radiobox->GetSelection());
}
/**
}
VolumeRendererManagerData::VolumeRendererManagerData(vtkImageData* vol, bool usegpu, std::string dataname){
- Initialize(vol, dataname, usegpu);
+ Initialize(vol, dataname, usegpu);
}
void VolumeRendererManagerData::Initialize(vtkImageData* vol, std::string dataname, bool usegpu){
_vol = vol;
- _dataname = dataname;
+ _dataname = dataname;
_tfun = vtkPiecewiseFunction::New();
_ctfun = vtkColorTransferFunction::New();
_MIPFunction = 0;
_boxWidgetS1 = 0;
-
-
-/* EED9Juin2011
+
+
+/* EED9Juin2011
if(usegpu && _vol->GetDataDimension() > 2){
_volumeMappergpu = vtkGPUVolumeRayCastMapper::New();
_volumeMappergpu->SetClippingPlanes( _volumePlanes );
vtkVolumeMapper *volMapperTmp;
if(usegpu && _vol->GetDataDimension() > 2){
#if (VTK_MAYOR_VERSION>=5 && VTK_MINOR_VERSION>=6)
- _volumeMappergpu = vtkGPUVolumeRayCastMapper::New();
+ _volumeMappergpu = vtkGPUVolumeRayCastMapper::New();
_volumeMappergpu->AutoAdjustSampleDistancesOn();
volMapperTmp = _volumeMappergpu;
#else
_volumeMapper->AutoAdjustSampleDistancesOn();
volMapperTmp = _volumeMapper;
}
-
+
volMapperTmp->SetClippingPlanes( _volumePlanes );
_newvol->SetMapper(volMapperTmp );
volMapperTmp->SetInput( _vol );
_boxWidgetS1->PlaceWidget();
vtkBoxWidgetCallback *callback = vtkBoxWidgetCallback::New();
-
+
if (_volumeMapper!=0){
callback->SetMapper(_volumeMapper);
} else {
callback->SetMapper(_volumeMappergpu);
- }
-
+ }
+
_boxWidgetS1->AddObserver(vtkCommand::InteractionEvent, callback);
callback->Delete();
_boxWidgetS1->EnabledOn();
for(int i = 0; i < colort->GetSize(); i++){
double val[6];
colort->GetNodeValue(i, val);
- //cout<< val[0]<<" "<< val[1]<<" "<<val[2]<<" "<< val[3]<<endl;
+ cout<< "JPRG::VolumeRendererManagerData::SetLookupTable::"<<val[0]<<" "<< val[1]<<" "<<val[2]<<" "<< val[3]<<endl;
_ctfun->AddRGBPoint(val[0], val[1], val[2], val[3]);
}
_newvol->Update();
+
}
_interpolation=false;
_shade=false;
+ _volumerendererdata = VolumeRendererData::New();
_volumeMapper = vtkVolumeRayCastMapper::New();
_newvol = vtkVolume::New();
_volumeProperty = vtkVolumeProperty::New();
}
+
+bool vtkClipping3DDataViewer::GetVisibleVolumeBox()
+{
+ return _visibleVolumeBox;
+}
+//-------------------------------------------------------------------
+void vtkClipping3DDataViewer::SetVisibleVolumeBox(bool visibleBox)
+{
+ _visibleVolumeBox = visibleBox;
+}
+
+
+
//-------------------------------------------------------------------
void vtkClipping3DDataViewer::Configure_Tissue()
{
_observerV->SetvtkVolumeRayCastMapper( _volumeMapper );
}
+
+void vtkClipping3DDataViewer::Configure_VolumeBox()
+{
+ cout<<"JPRG::vtkClipping3DDataViewer::Configure_VolumeBox()"<<endl;
+
+ _volumerendererdata->SetImageData(_vtkmprbasedata->GetImageData());
+
+
+ vector<double> *gv = this->GetGreyValuesTransferenceFVector();
+ vector<double> *op = this->GetIntensityValuesTransferenceFVector();
+
+
+ _volumerendererdata->SetLookUpTable((vtkLookupTable*)(_ctfun));
+ _volumerendererdata->OpacityChanged(*gv, *op);
+
+ //_wxvtkclipping3Dview->VisibleVolumeActor( false );
+ //_volumerendererdata->ShowVolume(event.IsChecked() );
+ //_volumerendererdata->BoundingBoxChanged(event.IsChecked() );
+}
+
+void vtkClipping3DDataViewer::SetRenderer(vtkRenderer* renderer)
+{
+ _volumerendererdata->SetRenderer(renderer);
+
+}
+
+void vtkClipping3DDataViewer::SetInteractor(vtkRenderWindowInteractor* interactor)
+{
+
+ _volumerendererdata->SetInteractor(interactor);
+}
+
+
+void vtkClipping3DDataViewer::BoxActorChanged(bool changed)
+{
+ vector<double> *gv = this->GetGreyValuesTransferenceFVector();
+ vector<double> *op = this->GetIntensityValuesTransferenceFVector();
+
+ _volumerendererdata->ShowVolume(changed);
+ _volumerendererdata->OpacityChanged(*gv, *op);
+ _volumerendererdata->BoundingBoxChanged(changed);
+
+}
+
+void vtkClipping3DDataViewer::UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun)
+{
+ _volumerendererdata->SetLookUpTable((vtkLookupTable*)(ctfun));
+ _volumerendererdata->OpacityChanged(gf, vf);
+}
+
+
void vtkClipping3DDataViewer::updateVolume()
{
if(_isRayCasting)
{
- cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isRayCasting"<<endl;
_volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
+ _volumerendererdata->changeCompositeMIPFunction(0);
}
else if(_isMIP)
{
- cout<<"JPRG::vtkClipping3DDataViewer::Configure_Volume::isMIP"<<endl;
-
_volumeMapper->SetVolumeRayCastFunction(_compositeFunctionMIP);
+ _volumerendererdata->changeCompositeMIPFunction(1);
}
if(_interpolation)
{
Configure_Tissue();
Configure_Volume();
-
+ Configure_VolumeBox();
// An outline provides context around the data.
//
_outlineData = vtkOutlineFilter::New();
#include "vtkVolume.h"
#include "vtkActor.h"
#include "vtkOutlineFilter.h"
+#include "vtkRenderWindowInteractor.h"
#include "vtkVolumeRayCastMIPFunction.h"
+#include "volumerendererdata.h"
+
class vtkClipping3DDataViewer {
public:
//----------------------
bool GetVisibleVolume();
void SetVisibleVolume(bool visibleVolume);
+ bool GetVisibleVolumeBox();
+ void SetVisibleVolumeBox(bool visibleBox);
+
void SetRepresentationType(int idTissue, bool representationType);
bool GetRepresentationType(int idTissue);
void ReadMeshVTK(char *namefile);
+ void Configure_VolumeBox();
+ void SetInteractor(vtkRenderWindowInteractor* interactor);
+ void SetRenderer(vtkRenderer* renderer);
+
//-------------------
//Getters Vectors
//-------------------
void updateVolume();
+ void BoxActorChanged(bool changed);
+ void UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun);
+
+
private:
vtkMPRBaseData *_vtkmprbasedata;
bool _visibleVolume;
+
+ bool _visibleVolumeBox;
+
+
bool _representationType[VTKMPRDATA_MAXTISSUE];
bool _visibleTissue[VTKMPRDATA_MAXTISSUE];
vtkActor *_tissue[VTKMPRDATA_MAXTISSUE];
bool _isMIP;
bool _interpolation;
bool _shade;
+
+ VolumeRendererData* _volumerendererdata;
};
#endif /*VTKCLIPPING3DDATAVIEWER_H_*/
Program: wxMaracas
Module: $RCSfile: wxMaracas_ViewerWidget.h,v $
Language: C++
- Date: $Date: 2010/10/29 07:51:06 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2011/06/29 09:37:52 $
+ Version: $Revision: 1.11 $
Copyright: (c) 2002, 2003
License:
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
class wxMaracas_ViewerWidget : public wxPanel
{
public:
-
+
//------------------------------------------------------------------------------------------------------------
// Constructors & Destructors
//------------------------------------------------------------------------------------------------------------
int mType;
bool minternalVtkmprbasedata;
- vtkMPRBaseData *mvtkmprbasedata;
+ vtkMPRBaseData *mvtkmprbasedata;
+
wxVtk2DBaseView *mvtk2Dbaseview;
- wxVtkMPR2DView *mvtkmpr2Dview_X;
- wxVtkMPR2DView *mvtkmpr2Dview_Y;
- wxVtkMPR2DView *mvtkmpr2Dview_Z;
+ wxVtkMPR2DView *mvtkmpr2Dview_X;
+ wxVtkMPR2DView *mvtkmpr2Dview_Y;
+ wxVtkMPR2DView *mvtkmpr2Dview_Z;
wxWidgetMesure2D_Plane_in_MPR *mwidgetMesure;
vtkPlane2DView *mvtkplane2Dview;
- wxSphereView *mwxsphereview;
+ wxSphereView *mwxsphereview;
wxVtkClipping3DView *mwxvtkclipping3Dview;
wxVtk3DBaseView *mwxvtk3Dbaseview_Clipping3D;
wxVtkMPR3DView *mwxvtkmpr3Dview;
- vtkMPR3DDataViewer *vtkmpr3Ddataviewer;
+ vtkMPR3DDataViewer *vtkmpr3Ddataviewer;
};
wxVtkClipping3DView::wxVtkClipping3DView(wxVtk3DBaseView* wxvtk3Dbaseview)
{
+
_wxvtk3Dbaseview = wxvtk3Dbaseview;
_vtkclipping3Ddataviewer = NULL;
_wxvtkclipping3DviewCntrlPanel = NULL;
}
}
//-------------------------------------------------------------------
-void wxVtkClipping3DView::SetVisibleBoxVolume(bool visible)
+void wxVtkClipping3DView::VisibleVolumeBoxActor(bool visible)
{
- if (_boxWidgetVolume!=NULL){
- if (visible==true){
- _boxWidgetVolume->On();
- } else {
- _boxWidgetVolume->Off();
- }
+ if (visible!=_vtkclipping3Ddataviewer->GetVisibleVolumeBox() ){
+ VisibleVolumeActor(!visible);
+ _vtkclipping3Ddataviewer->BoxActorChanged(visible);
+ _vtkclipping3Ddataviewer->SetVisibleVolumeBox(visible);
+ _vtkclipping3Ddataviewer->SetVisibleVolume(!visible);
}
}
//-------------------------------------------------------------------
}
_vtkclipping3Ddataviewer->SetVisibleVolume(visVolume);
}
+ else if(visVolume==false && _vtkclipping3Ddataviewer->GetVisibleVolumeBox() == true)
+ {
+ _vtkclipping3Ddataviewer->BoxActorChanged(false);
+ _vtkclipping3Ddataviewer->SetVisibleVolumeBox(false);
+ }
+
}
//-------------------------------------------------------------------
wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*)
int i;
for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
{
- _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent , _vtkclipping3Ddataviewer->GetObserverS(i) );
+ _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent, _vtkclipping3Ddataviewer->GetObserverS(i) );
}
// clips out objects behind the plane. This way only what is drawn
// between the planes is actually rendered.
_wxvtk3Dbaseview->GetRenderer()->ResetCameraClippingRange();
+
+
+
+
+ //cout<<"JPRG::wxVtkClipping3DView::SetVtkClipping3DDataViewer::GetRenderer()::"<<this->GetWxvtk3Dbaseview()->GetRenderer()<<endl;
+ //cout<<"JPRG::wxVtkClipping3DView::SetVtkClipping3DDataViewer::GetWxVTKRenderWindowInteractor()::"<<this->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()<<endl;
+
+ _vtkclipping3Ddataviewer->SetRenderer(this->GetWxvtk3Dbaseview()->GetRenderer());
+ _vtkclipping3Ddataviewer->SetInteractor(this->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor());
+
}
//-------------------------------------------------------------------
void wxVtkClipping3DView::SetVtkClipping3DDataViewer(vtkClipping3DDataViewer *vtkclipping3Ddataviewer)
_vtkclipping3Ddataviewer->updateVolume();
}
+void wxVtkClipping3DView::UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun)
+{
+ _vtkclipping3Ddataviewer->UpdateVolumeBox(gf, vf, ctfun);
+}
+
+
#include "wxVtk3DBaseView.h"
#include "wx/wx.h"
#include "vtkBoxWidget.h"
+
//#include "wxVtkClipping3DViewCntrlPanel.h"
//class wxVtkClipping3DViewCntrlPanel;
void VisibleActor(int idTissue, bool visTissue);
void VisibleVolumeActor( bool visVolume );
+
+ void VisibleVolumeBoxActor(bool visible);
+
void SetVisibleBoxSurface(bool visible);
void SetVisibleBoxVolume(bool visible);
void SetRepSurfaceWireFrame(int idTissue , bool typeRepresentation );
void SetInterpolation(bool active);
void SetShade(bool active);
+ void UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun);
+
private:
wxVtk3DBaseView *_wxvtk3Dbaseview;
_surfD = new wxRadioButton(panel,-1,_T("D"));
- //RaC 03-2010 Divides in two panels thje last tab Surface/Volume
+ //RaC 03-2010 Divides in two panels thje last tab Surface/Volume
//wxCheckBox *ckVolum = new wxCheckBox(panel,-1,_T("Vol"));
wxCheckBox *ckBoxSurface = new wxCheckBox(panel,-1,_T("Surface Box"));
-
- //RaC 03-2010 Divides in two panels thje last tab Surface/Volume
+
+ //RaC 03-2010 Divides in two panels thje last tab Surface/Volume
//wxCheckBox *ckBoxVolume = new wxCheckBox(panel,-1,_T("Volume Box"));
_color = new wxButton(panel,-1,_T(""));
_isoValueSpin = new wxSlider(panel , -1,5,1,10,wxDefaultPosition , wxSize(25,45), wxSL_VERTICAL | wxSL_AUTOTICKS |wxSL_LEFT );
_isoValueSpin->SetRange(1,8);
_isoValueSpin->SetValue(5);
- Connect(_isoValueSpin->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnIsoValueSpin );
+ Connect(_isoValueSpin->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnIsoValueSpin );
wxButton *btnSTL = new wxButton(panel,-1,_T("Create STL File"));
wxButton *btnSaveRaw = new wxButton(panel,-1,_T("Save Raw Volume"));
- //RaC 03-2010 Divides in two panels thje last tab Surface/Volume
+ //RaC 03-2010 Divides in two panels thje last tab Surface/Volume
//wxButton *btnVolumeFunctions = new wxButton(panel,-1,_T("Read Volume Functions"));
- Connect(btnSTL->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL );
- Connect(btnSaveRaw->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnSaveRawVolume );
-
- //RaC 03-2010 Divides in two panels thje last tab Surface/Volume
- //Connect(btnVolumeFunctions->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions );
+ Connect(btnSTL->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL );
+ Connect(btnSaveRaw->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnSaveRawVolume );
+
+ //RaC 03-2010 Divides in two panels thje last tab Surface/Volume
+ //Connect(btnVolumeFunctions->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions );
wxButton *btnMeshVTKLoad = new wxButton(panel,-1,_T("Load Mesh"));
- Connect(btnMeshVTKLoad->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnMeshVTKLoad );
+ Connect(btnMeshVTKLoad->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnMeshVTKLoad );
/*
// ckVolum->Enable(false);
ckBoxSurface->SetValue(false);
-
-
+
+
//ckBoxVolume->SetValue(false);
// _positionY->SetSize(400,20);
// _positionZ->SetSize(400,20);
- //RaC 03-2010 Divides in two panels thje last tab Surface/Volume
+ //RaC 03-2010 Divides in two panels thje last tab Surface/Volume
//Connect(ckVolum->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleVolume );
//Connect(ckBoxVolume->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleBoxVolume );
//wxFlexGridSizer *sizerH5 = new wxFlexGridSizer(10); // JPRx
//wxFlexGridSizer *sizerH6 = new wxFlexGridSizer(10); // JPRx
- //RaC 03-2010 Divides in two panels thje last tab Surface/Volume
+ //RaC 03-2010 Divides in two panels thje last tab Surface/Volume
//sizerH0->Add( ckVolum , 1, wxALL|wxEXPAND, 0);
//sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
//sizerH0->Add( ckBoxVolume , 1, wxALL|wxEXPAND, 0);
sizerH2->Add( _visible , 1, wxALL|wxEXPAND, 0);
sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
-
+
sizerH2->Add( _wireFrameRep , 1,wxSHAPED | wxALIGN_CENTER_VERTICAL , 0);
sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
sizerH2->Add( _surfaceRep , 1,wxSHAPED | wxALIGN_CENTER_VERTICAL , 0);
sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
-
+
sizerH2->Add( _opacity , 1, wxALL|wxEXPAND, 0);
_opacity->SetValue( (int)(tmpActor->GetProperty()->GetOpacity()*100) );
// Representation Type WireFrame / Surface
- _surfaceRep->SetValue(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue));
- _wireFrameRep->SetValue(!_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue));
+ _surfaceRep->SetValue(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue));
+ _wireFrameRep->SetValue(!_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue));
// isoValue
int isoValue= (int)(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetIsovalue(idTissue));
//-------------------------------------------------------------------
void wxVtkClipping3DViewCntrlPanel::OnVisibleBoxVolume(wxCommandEvent& event)
{
- _wxvtkclipping3Dview->SetVisibleBoxVolume(event.IsChecked() );
+ //_wxvtkclipping3Dview->SetVisibleBoxVolume(event.IsChecked() );
+ this->BoundingBoxChanged(event.IsChecked());
_wxvtkclipping3Dview->Refresh();
}
//-------------------------------------------------------------------
// EED 17 Janvier 2007
wxColourDialog dlgColour(this);
// dlgColour.ShowModal();
- if( dlgColour.ShowModal( ) == wxID_OK )
+ if( dlgColour.ShowModal( ) == wxID_OK )
{
vtkActor *tmpActor;
tmpActor = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueActor(idTissue);
_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->SetIsovalue(idTissue,isoValue);
// wxString tmpStr;
// tmpStr.Printf("%d",isoValue);
-
+
_wxvtkclipping3Dview->Refresh();
wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
wxString dirSTL = wxGetHomeDir( ) ;
wxFileDialog dialog( this, _T("Choose a directory..."), dirSTL , _T(""), _T("*.*"), wxSAVE );
- if( dialog.ShowModal( ) == wxID_OK )
+ if( dialog.ShowModal( ) == wxID_OK )
{
-
-
+
+
// ------------------------------------------------------------------------
// 1. GENERATE STL FILES
// ------------------------------------------------------------------------
writer->Write();
writer->Delete();
-
+
filtro->Delete();
cpd->Delete();
pdcf->Delete();
//-------------------------------------------------------------------
void wxVtkClipping3DViewCntrlPanel::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();
#define WXVTKCLIPPING3DVIEWCNTRLPANEL_H_
#include "wxVtkClipping3DView.h"
+#include "volumerendererdata.h"
#include "wx/wx.h"
-class wxVtkClipping3DViewCntrlPanel: public wxPanel
+class wxVtkClipping3DViewCntrlPanel: public wxPanel, VolumeRendererData
{
public:
wxVtkClipping3DViewCntrlPanel(wxWindow *parent, wxVtkClipping3DView *_wxvtkclipping3Dview);
_wxvtkclipping3Dview = wxvtkclipping3Dview;
- wxCheckBox *ckVolum = new wxCheckBox(panel,-1,_T("Volume"));
- wxCheckBox *ckBoxVolume = new wxCheckBox(panel,-1,_T("Volume Box"));
+ ckVolum = new wxCheckBox(panel,-1,_T("Volume"));
+ ckBoxVolume = new wxCheckBox(panel,-1,_T("Volume Box"));
ckBoxVolume->Disable();
rbRayCasting->SetValue(true);
+// _volumerendererdata = VolumeRendererData::New();
+// _volumerendererdata->SetImageData(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData());
+
}
//-------------------------------------------------------------------
wxVtkClipping3DViewVolCntrlPanel::~wxVtkClipping3DViewVolCntrlPanel()
//-------------------------------------------------------------------
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();
- }
+
+
+
+ if(event.IsChecked())
+ {
+ ckBoxVolume->Enable();
+ }
+ else{
+ ckBoxVolume->Disable();
+ }
+
+ // _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetRenderer()->RemoveAllViewProps();
+
+
+
+ _wxvtkclipping3Dview->VisibleVolumeActor( event.IsChecked() );
+ if(event.IsChecked())
+ {
+ rbRayCasting->Enable();
+ rbMIP->Enable();
+ ckInterpolation->Enable();
+ ckShade->Enable();
+ }
+ else
+ {
+ rbRayCasting->Disable();
+ rbMIP->Disable();
+ ckInterpolation->Disable();
+ ckShade->Disable();
+ if(ckBoxVolume->IsChecked())
+ {
+ ckBoxVolume->SetValue(false);
+ }
+ }
+
_wxvtkclipping3Dview->Refresh();
+
wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
_wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
}
//-------------------------------------------------------------------
void wxVtkClipping3DViewVolCntrlPanel::OnVisibleBoxVolume(wxCommandEvent& event)
{
- _wxvtkclipping3Dview->SetVisibleBoxVolume(event.IsChecked() );
- _wxvtkclipping3Dview->Refresh();
+
+ //cout<<"JPRG::wxVtkClipping3DViewVolCntrlPanel::OnVisibleVolume::event_value::"<<event.IsChecked()<<endl;
+
+
+ if(event.IsChecked())
+ {
+ // rbRayCasting->Disable();
+ // rbMIP->Disable();
+ ckInterpolation->Disable();
+ ckShade->Disable();
+ }
+ else
+ {
+ //rbRayCasting->Enable();
+ //rbMIP->Enable();
+ ckInterpolation->Enable();
+ ckShade->Enable();
+
+ }
+
+ _wxvtkclipping3Dview->VisibleVolumeBoxActor(event.IsChecked());
+
+ _wxvtkclipping3Dview->Refresh();
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+
}
//EED 22 Fevrier 2007
// Refreshing and sending the event
//---------------------------------
//_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions();
+
+
+ //test
+
+
+ // _volumerendererdata->OpacityChanged(*gtf, *itf);
+ _wxvtkclipping3Dview->UpdateVolumeBox(*gtf, *itf, ctfun);
+
+//test end
+
_wxvtkclipping3Dview->Refresh();
wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
_wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
/*
volumeMapper->Update();
newvol->Update();
+
+
*/
} else {
if(hDlg->getRefreshed())
// Refreshing and sending the event
//---------------------------------
//_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions();
- _wxvtkclipping3Dview->Refresh();
+
+
wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
_wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+
+ _wxvtkclipping3Dview->Refresh();
+
/*
volumeMapper->Update();
newvol->Update();
}
//destroy the dialog
+
+
hDlg->Destroy();
}
//If Ray Casting is active, others options are disabled. Only RayCasting is true
_wxvtkclipping3Dview->SetRayCasting(true);
_wxvtkclipping3Dview->SetMIPActive(false);
+
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
_wxvtkclipping3Dview->Refresh();
}
_wxvtkclipping3Dview->SetMIPActive(true);
_wxvtkclipping3Dview->SetRayCasting(false);
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+
_wxvtkclipping3Dview->Refresh();
}
void wxVtkClipping3DViewVolCntrlPanel::OnInterpolationActive(wxCommandEvent& event){
+
+
_wxvtkclipping3Dview->SetInterpolation(event.IsChecked());
+
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
_wxvtkclipping3Dview->Refresh();
}
void wxVtkClipping3DViewVolCntrlPanel::OnShadeActive(wxCommandEvent& event){
+
+
_wxvtkclipping3Dview->SetShade(event.IsChecked());
+
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
_wxvtkclipping3Dview->Refresh();
}
#include "wxVtkClipping3DView.h"
#include "wx/wx.h"
+#include "volumerendererdata.h"
class wxVtkClipping3DViewVolCntrlPanel: public wxPanel
{
private:
wxVtkClipping3DView *_wxvtkclipping3Dview;
+
wxRadioButton *rbRayCasting;
wxRadioButton *rbMIP;
wxCheckBox *ckInterpolation;
wxCheckBox *ckShade;
+ wxCheckBox *ckVolum;
+ wxCheckBox *ckBoxVolume;
+
protected: