/**
** Updates volume
**/
-void wxMaracasSurfaceRenderingManager::Update(int pid)throw(char*){
- wxMaracasSurfaceRenderingManagerData* data = this->getViewData(pid);
- ((wxMaracasSurfaceRenderingManagerDataMhd*)data)->UpdateSurface();
- _renderer->Render();
+// EED 2022-08-04
+//void wxMaracasSurfaceRenderingManager::Update(int pid)throw(char *)
+void wxMaracasSurfaceRenderingManager::Update(int pid)
+{
+ try {
+ wxMaracasSurfaceRenderingManagerData* data = this->getViewData(pid);
+ ((wxMaracasSurfaceRenderingManagerDataMhd*)data)->UpdateSurface();
+ _renderer->Render();
+ } catch (...) {
+ throw ;
+ }
}
/**
** Adds a prop3D to the manager and returns the identifier
**/
-int wxMaracasSurfaceRenderingManager::addProp3D(int idTP, vtkProp3D* prop3D, std::string dataname) throw(char*){
+// EED 2022-08-04
+//int wxMaracasSurfaceRenderingManager::addProp3D(int idTP, vtkProp3D* prop3D, std::string dataname) throw(char*){
+int wxMaracasSurfaceRenderingManager::addProp3D(int idTP, vtkProp3D* prop3D, std::string dataname){
//checkInvariant();
- if(prop3D != NULL){
- wxMaracasSurfaceRenderingManagerData* data = new wxMaracasSurfaceRenderingManagerData(prop3D, dataname, _interactor);
- prop3Dvect.push_back(data);
- _renderer->AddActor(data->getProp3D());
- if(idTP == -1)
- {
- data->setId(_idCount);
- _idCount++;
- }
- else
+ try {
+ if(prop3D != NULL)
{
- data->setId(idTP);
+ wxMaracasSurfaceRenderingManagerData* data = new wxMaracasSurfaceRenderingManagerData(prop3D, dataname, _interactor);
+ prop3Dvect.push_back(data);
+ _renderer->AddActor(data->getProp3D());
+ if(idTP == -1)
+ {
+ data->setId(_idCount);
+ _idCount++;
+ }
+ else
+ {
+ data->setId(idTP);
+ }
+ return data->getId();
+ }else{
+ throw "Check vtkProp3D file or input";
}
- return data->getId();
- }else{
- throw "Check vtkProp3D file or input";
+ return -1;
+ } catch (...) {
+ throw ;
}
- return -1;
+
}
/**
}
-int wxMaracasSurfaceRenderingManager::addPropMHD(int idTP, vtkImageData* imagedata, std::string dataname) throw(char*){
- checkInvariant();
- if(imagedata != NULL){
- image = imagedata;
- wxMaracasSurfaceRenderingManagerData* data = new wxMaracasSurfaceRenderingManagerDataMhd(imagedata, dataname, _interactor);
- prop3Dvect.push_back(data);
- _renderer->AddActor(data->getProp3D());
- if(idTP == -1)
- {
- data->setId(_idCount);
- _idCount++;
- }
- else
- {
- data->setId(idTP);
+// EED 2022-08-04
+//int wxMaracasSurfaceRenderingManager::addPropMHD(int idTP, vtkImageData* imagedata, std::string dataname) throw(char*){
+int wxMaracasSurfaceRenderingManager::addPropMHD(int idTP, vtkImageData* imagedata, std::string dataname) {
+ try{
+ checkInvariant();
+ if(imagedata != NULL){
+ image = imagedata;
+ wxMaracasSurfaceRenderingManagerData* data = new wxMaracasSurfaceRenderingManagerDataMhd(imagedata, dataname, _interactor);
+ prop3Dvect.push_back(data);
+ _renderer->AddActor(data->getProp3D());
+ if(idTP == -1)
+ {
+ data->setId(_idCount);
+ _idCount++;
+ }
+ else
+ {
+ data->setId(idTP);
+ }
+ printf("wxMaracasSurfaceRenderingManager::addPropMHD->idSurfaceRender: %i\n", data->getId());
+ return data->getId();
+ }else{
+ throw "Check ImageData file or input";
}
- printf("wxMaracasSurfaceRenderingManager::addPropMHD->idSurfaceRender: %i\n", data->getId());
- return data->getId();
- }else{
- throw "Check ImageData file or input";
- }
- return -1;
+ return -1;
+ } catch (...) {
+ throw ;
+ }
}
/**
** adds or removes an actor depending of the bool value
**/
-bool wxMaracasSurfaceRenderingManager::addRemoveActor(int propid, bool addremove) throw(char*){
- checkInvariant();
-
- wxMaracasSurfaceRenderingManagerData* data = this->getViewData(propid);
- if(data && data->getProp3D()!=NULL){
- if(addremove){
- _renderer->AddViewProp(data->getProp3D());
- }else{
- _renderer->RemoveViewProp(data->getProp3D());
- }
- _renderer->Render();
- return true;
- }else {
- if(addremove && propid == 0 && image){
- addPropMHD(0, image, "id0");
- return true;
- }
- }
- return false;
+// EED 2022-08-04
+//bool wxMaracasSurfaceRenderingManager::addRemoveActor(int propid, bool addremove) throw(char*){
+bool wxMaracasSurfaceRenderingManager::addRemoveActor(int propid, bool addremove) {
+ try{
+ checkInvariant();
+
+ wxMaracasSurfaceRenderingManagerData* data = this->getViewData(propid);
+ if(data && data->getProp3D()!=NULL){
+ if(addremove){
+ _renderer->AddViewProp(data->getProp3D());
+ }else{
+ _renderer->RemoveViewProp(data->getProp3D());
+ }
+ _renderer->Render();
+ return true;
+ }else {
+ if(addremove && propid == 0 && image){
+ addPropMHD(0, image, "id0");
+ return true;
+ }
+ }
+ return false;
+ } catch (...) {
+ throw ;
+ }
}
/**
** adds or removes the surface box depending of the bool value
**/
-void wxMaracasSurfaceRenderingManager::addRemoveSurfaceBox(int propid, bool addremove) throw(char*){
- checkInvariant();
-
- wxMaracasSurfaceRenderingManagerData* data = this->getViewData(propid);
- if(data->getProp3D()!=NULL){
- data->addRemoveSurfaceBox(addremove);
- /*if(addremove){
- data->
- _renderer->AddViewProp(data->getProp3D());
- }else{
- _renderer->RemoveViewProp(data->getProp3D());
+// EED 2022-08-04
+//void wxMaracasSurfaceRenderingManager::addRemoveSurfaceBox(int propid, bool addremove) throw(char*){
+void wxMaracasSurfaceRenderingManager::addRemoveSurfaceBox(int propid, bool addremove)
+{
+ try{
+ checkInvariant();
+ wxMaracasSurfaceRenderingManagerData* data = this->getViewData(propid);
+ if(data->getProp3D()!=NULL){
+ data->addRemoveSurfaceBox(addremove);
+ /*if(addremove){
+ data->
+ _renderer->AddViewProp(data->getProp3D());
+ }else{
+ _renderer->RemoveViewProp(data->getProp3D());
+ }
+ _renderer->Render();*/
}
- _renderer->Render();*/
- }
-
+ } catch (...) {
+ throw ;
+ }
}
/**
** Changes the opacity in a prop3D
**/
-void wxMaracasSurfaceRenderingManager::changeOpacity(int propid, int value) throw(char*){
- checkInvariant();
-
-
- this->getViewData(propid)->changeOpacity(value);
-
- _renderer->Render();
-
+// EED 2022-08-04
+//void wxMaracasSurfaceRenderingManager::changeOpacity(int propid, int value) throw(char*){
+void wxMaracasSurfaceRenderingManager::changeOpacity(int propid, int value)
+{
+ try{
+ checkInvariant();
+ this->getViewData(propid)->changeOpacity(value);
+ _renderer->Render();
+ } catch (...) {
+ throw ;
+ }
}
/**
**/
void wxMaracasSurfaceRenderingManager::changeIsoValue(int propid, double value ){
checkInvariant();
-
wxMaracasSurfaceRenderingManagerData* data = this->getViewData(propid);
-
//_renderer->RemoveActor(data->getProp3D());
((wxMaracasSurfaceRenderingManagerDataMhd*)data)->changeIsoValue(value);
//_renderer->AddActor(data->getProp3D());
-
_renderer->Render();
}
**/
void wxMaracasSurfaceRenderingManager::changeIsoValue(int propid, double min, double max ){
checkInvariant();
-
wxMaracasSurfaceRenderingManagerData* data = this->getViewData(propid);
-
//_renderer->RemoveActor(data->getProp3D());
((wxMaracasSurfaceRenderingManagerDataMhd*)data)->changeIsoValue(min, max);
//_renderer->AddActor(data->getProp3D());
-
_renderer->Render();
}
return NULL;
}*/
-vtkImageData* wxMaracasSurfaceRenderingManager::getImageData(std::string filename){
- if(filename.compare("")!= 0){
-
+vtkImageData* wxMaracasSurfaceRenderingManager::getImageData(std::string filename)
+{
+ if(filename.compare("")!= 0)
+ {
vtkMetaImageReader* reader = vtkMetaImageReader::New();
reader->SetFileName(filename.c_str());
reader->Update();
return NULL;
}
-vtkImageData* wxMaracasSurfaceRenderingManager::getImageData(){
+vtkImageData* wxMaracasSurfaceRenderingManager::getImageData()
+{
return image;
}
-void wxMaracasSurfaceRenderingManager::setImageData(vtkImageData* img){
+void wxMaracasSurfaceRenderingManager::setImageData(vtkImageData* img)
+{
image = img;
}
-void wxMaracasSurfaceRenderingManager::checkInvariant() throw(char*){
- if(this->_renderer==NULL){
- throw "Renderer not set";
- }
+// EED 2022-08-04
+//void wxMaracasSurfaceRenderingManager::checkInvariant() throw(char*)
+void wxMaracasSurfaceRenderingManager::checkInvariant()
+{
+ try{
+ if(this->_renderer==NULL)
+ {
+ throw "Renderer not set";
+ }
+ } catch (...) {
+ throw ;
+ }
}
-wxMaracasSurfaceRenderingManagerData* wxMaracasSurfaceRenderingManager::getViewData(int id) throw(char*){
- int i = 0;
- for(i = 0; i < (int)(prop3Dvect.size());i++){
- if(prop3Dvect[i]->getId() == id){
- return prop3Dvect[i];
- }
- }
-#ifndef USE_QT
- throw "id not found in the data";
-#else
- return 0;
-#endif
-
-
+// EED 2022-08-04
+//wxMaracasSurfaceRenderingManagerData* wxMaracasSurfaceRenderingManager::getViewData(int id) throw(char*)
+wxMaracasSurfaceRenderingManagerData* wxMaracasSurfaceRenderingManager::getViewData(int id)
+{
+ try{
+ int i = 0;
+ for(i = 0; i < (int)(prop3Dvect.size());i++){
+ if(prop3Dvect[i]->getId() == id){
+ return prop3Dvect[i];
+ }
+ }
+ #ifndef USE_QT
+ throw "id not found in the data";
+ #else
+ return 0;
+ #endif
+ } catch (...) {
+ throw ;
+ }
}
-int wxMaracasSurfaceRenderingManager::getMaxIsoValue(int propid) throw(char*){
-
- return ((wxMaracasSurfaceRenderingManagerDataMhd*)this->getViewData(propid))->getMaxGreyLevel();
-
+// EED 2022-08-04
+//int wxMaracasSurfaceRenderingManager::getMaxIsoValue(int propid) throw(char*)
+int wxMaracasSurfaceRenderingManager::getMaxIsoValue(int propid)
+{
+ try{
+ return ((wxMaracasSurfaceRenderingManagerDataMhd*)this->getViewData(propid))->getMaxGreyLevel();
+ } catch (...) {
+ throw ;
+ }
}
-void wxMaracasSurfaceRenderingManager::changeColor(int propid, double red, double green, double blue) throw(char*){
- checkInvariant();
- this->getViewData(propid)->changeColor(red, green, blue);
-
- _renderer->Render();
+// EED 2022-08-04
+//void wxMaracasSurfaceRenderingManager::changeColor(int propid, double red, double green, double blue) throw(char*)
+void wxMaracasSurfaceRenderingManager::changeColor(int propid, double red, double green, double blue)
+{
+ try{
+ checkInvariant();
+ this->getViewData(propid)->changeColor(red, green, blue);
+ _renderer->Render();
+ } catch (...) {
+ throw ;
+ }
+
}
-void wxMaracasSurfaceRenderingManager::deleteActor(int propid) throw (char *){
- checkInvariant();
-
- this->addRemoveActor(propid, false);
-
- int i,n;
- bool exit = false;
- for(i = 0; i < (int)(prop3Dvect.size())&&!exit;i++){
- if(prop3Dvect[i]->getId() == propid){
- n=i;
- exit = true;
+// EED 2022-08-04
+//void wxMaracasSurfaceRenderingManager::deleteActor(int propid) throw (char *)
+void wxMaracasSurfaceRenderingManager::deleteActor(int propid)
+{
+ try{
+ checkInvariant();
+ this->addRemoveActor(propid, false);
+ int i,n;
+ bool exit = false;
+ for(i = 0; i < (int)(prop3Dvect.size())&&!exit;i++){
+ if(prop3Dvect[i]->getId() == propid){
+ n=i;
+ exit = true;
+ }
}
- }
- if(exit){
- wxMaracasSurfaceRenderingManagerData* data = prop3Dvect[n];
- int j;
- for(j = i; j < (int)(prop3Dvect.size())-1;j++){
- prop3Dvect[j] = prop3Dvect[j+1];
- }
- delete data;
- prop3Dvect.pop_back();
- }else{
-#ifndef USE_QT
- throw "id not found in the data";
-#endif
-
- }
+ if(exit){
+ wxMaracasSurfaceRenderingManagerData* data = prop3Dvect[n];
+ int j;
+ for(j = i; j < (int)(prop3Dvect.size())-1;j++){
+ prop3Dvect[j] = prop3Dvect[j+1];
+ }
+ delete data;
+ prop3Dvect.pop_back();
+ }else{
+ #ifndef USE_QT
+ throw "id not found in the data";
+ #endif
+ }
+ } catch (...) {
+ throw ;
+ }
+
}
void wxMaracasSurfaceRenderingManager::enableBoundingBox(int propid, bool enable){
#include <iostream>
#include <vector>
+
//EED 2022-07-21
//#include <vtkMatrix4x4.h>
-
class wxMaracasSurfaceRenderingManager {
public:
/**
** Updates surface
**/
- void Update(int pid)throw(char*);
+// void Update(int pid)throw(char*);
+// void Update(int pid)throw(int);
+ void Update(int pid);
/**
** Adds a prop3D to the manager and returns the identifier
**/
- int addProp3D(int idTP, vtkProp3D* prop3D, std::string dataname) throw (char*);
+// EED 2022-08-04
+// int addProp3D(int idTP, vtkProp3D* prop3D, std::string dataname) throw (char*);
+ int addProp3D(int idTP, vtkProp3D* prop3D, std::string dataname);
/**
** Adds a polydata and creates the prop3D (actor) to the manager and returns the identifier
/**
** Adds a prop3D to the manager and returns the identifier
**/
- int addPropMHD(int idTP, vtkImageData* imagedata, std::string dataname) throw(char*);
+// EED 2022-08-04
+// int addPropMHD(int idTP, vtkImageData* imagedata, std::string dataname) throw(char*);
+ int addPropMHD(int idTP, vtkImageData* imagedata, std::string dataname) ;
/**
** Changes the opacity in a prop3D
**/
- void changeOpacity(int propid, int value)throw(char*);
+// EED 2022-08-04
+// void changeOpacity(int propid, int value)throw(char*);
+ void changeOpacity(int propid, int value);
/**
** changes the isovalue in a prop3D
/**
** adds or removes an actor depending of the bool value
**/
- bool addRemoveActor(int propid, bool addremove)throw(char*);
+// EED 2022-08-04
+// bool addRemoveActor(int propid, bool addremove)throw(char*);
+ bool addRemoveActor(int propid, bool addremove);
/**
**
**/
- void addRemoveSurfaceBox(int propid, bool addremove) throw(char*);
+// EED 2022-08-04
+// void addRemoveSurfaceBox(int propid, bool addremove) throw(char*);
+ void addRemoveSurfaceBox(int propid, bool addremove);
/**
** Check if the variables are setted correctly
**/
- void checkInvariant()throw(char*);
+// EED 2022-08-04
+// void checkInvariant()throw(char*);
+ void checkInvariant();
/**
** Given an id search the data in the vector
**/
- wxMaracasSurfaceRenderingManagerData* getViewData(int id)throw(char*);
+// EED 2022-08-04
+// wxMaracasSurfaceRenderingManagerData* getViewData(int id)throw(char*);
+ wxMaracasSurfaceRenderingManagerData* getViewData(int id);
/**
**
/**
** Given the id, return the max iso value from the imagedata
**/
- int getMaxIsoValue(int propid)throw(char*);
+// EED 2022-08-04
+// int getMaxIsoValue(int propid)throw(char*);
+ int getMaxIsoValue(int propid);
/**
** Changes the color of the actor
**/
- void changeColor(int propid, double red, double green, double blue) throw(char*);
+// EED 2022-08-04
+// void changeColor(int propid, double red, double green, double blue) throw(char*);
+ void changeColor(int propid, double red, double green, double blue);
- void deleteActor(int propid)throw (char *);
+// EED 2022-08-04
+// void deleteActor(int propid)throw (char *);
+ void deleteActor(int propid);
void Transform(vtkMatrix4x4* tmatrix);
/**
** Adds a prop3D to the manager and returns the identifier
**/
-int VolumeRendererManager::addVolume(int idTP, vtkImageData* vol, std::string dataname) throw(char*){
+
+// EED 2022-08-04 C++17 throw
+//int VolumeRendererManager::addVolume(int idTP, vtkImageData* vol, std::string dataname) throw(char*)
+int VolumeRendererManager::addVolume(int idTP, vtkImageData* vol, std::string dataname)
+{
+ try {
checkInvariant();
image = vol;
if(vol != NULL){
}else{
throw "Check mhd imagefile file or input";
}
- return -1;
+ return -1;
+ } catch (...) {
+ throw ;
+ }
}
/**
** adds or removes an actor depending of the bool value
**/
-void VolumeRendererManager::addRemoveActor(int propid, bool addremove) throw(char*){
+// EED 2022-08-04 C++17 throw
+//void VolumeRendererManager::addRemoveActor(int propid, bool addremove) throw(char*)
+void VolumeRendererManager::addRemoveActor(int propid, bool addremove)
+{
+ try {
checkInvariant();
-
VolumeRendererManagerData* data = this->getViewData(propid);
if(data->getProp3D()!=NULL){
if(addremove){
}
_renderer->Render();
}
-
+ } catch (...) {
+ throw ;
+ }
}
/**
** Changes the opacity in a prop3D
**/
-void VolumeRendererManager::setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value) throw(char*){
- checkInvariant();
-
- printf("EED VolumeRendererManager::setVolumeOpacity %d\n",propid);
-
- VolumeRendererManagerData* volrenman = this->getViewData(propid);
- if (volrenman!=NULL)
- {
- volrenman->setVolumeOpacity(greylevel, value);
- } else {
- printf("EED VolumeRendererManager::setVolumeOpacity Warning volrenman NULL\n");
- }
-
- _renderer->Render();
-
+// EED 2022-08-04 C++17 throw
+//void VolumeRendererManager::setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value) throw(char*)
+void VolumeRendererManager::setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value)
+{
+ try {
+ checkInvariant();
+ VolumeRendererManagerData* volrenman = this->getViewData(propid);
+ if (volrenman!=NULL)
+ {
+ volrenman->setVolumeOpacity(greylevel, value);
+ } else {
+ printf("EED VolumeRendererManager::setVolumeOpacity Warning volrenman NULL\n");
+ }
+ _renderer->Render();
+ } catch (...) {
+ throw ;
+ }
}
/**
** Set Volume Color
**/
+// EED 2022-08-04 C++17 throw
+//void VolumeRendererManager::setVolumeColor(int volid, std::vector<double> greylevel,
+// std::vector<double> red,
+// std::vector<double> green,
+// std::vector<double> blue)throw(char*)
void VolumeRendererManager::setVolumeColor(int volid, std::vector<double> greylevel,
std::vector<double> red,
std::vector<double> green,
- std::vector<double> blue)throw(char*){
- printf("EED VolumeRendererManager::setVolumeColor start \n");
- checkInvariant();
-
- printf("EED VolumeRendererManager::setVolumeColor %d\n",volid);
-
- VolumeRendererManagerData* volrenman = this->getViewData(volid);
- if (volrenman!=NULL)
- {
- this->getViewData(volid)->setVolumeColor(greylevel, red, green, blue);
- } else {
- printf("EED VolumeRendererManager::setVolumeColor Warning volrenman NULL\n");
- }
-
- _renderer->Render();
- printf("EED VolumeRendererManager::setVolumeColor end \n");
+ std::vector<double> blue)
+{
+ try {
+ checkInvariant();
+ VolumeRendererManagerData* volrenman = this->getViewData(volid);
+ if (volrenman!=NULL)
+ {
+ this->getViewData(volid)->setVolumeColor(greylevel, red, green, blue);
+ } else {
+ printf("EED VolumeRendererManager::setVolumeColor Warning volrenman NULL\n");
+ }
+ _renderer->Render();
+ } catch (...) {
+ throw ;
+ }
}
vtkImageData* VolumeRendererManager::getImageData(std::string filename){
return image;
}
-void VolumeRendererManager::checkInvariant() throw(char*){
- printf("EED VolumeRendererManager::checkInvariant start\n");
- if(this->_renderer==NULL){
- throw "Renderer not set";
- }
- printf("EED VolumeRendererManager::checkInvariant end \n");
+// EED 2022-08-04 C++17 throw
+//void VolumeRendererManager::checkInvariant() throw(char*)
+void VolumeRendererManager::checkInvariant()
+{
+ try{
+ if(this->_renderer==NULL)
+ {
+ throw "Renderer not set";
+ }
+ } catch (...) {
+ throw ;
+ }
}
-VolumeRendererManagerData* VolumeRendererManager::getViewData(int id) throw(char*){
- int i;
- for(i = 0; i < (int)(prop3Dvect.size());i++){
- if(prop3Dvect[i]->getId() == id){
- return prop3Dvect[i];
- }
- }
- throw "id not found in the data";
-
- return NULL;
+// EED 2022-08-04 C++17 throw
+//VolumeRendererManagerData* VolumeRendererManager::getViewData(int id) throw(char*)
+VolumeRendererManagerData* VolumeRendererManager::getViewData(int id)
+{
+ try{
+ int i;
+ for(i = 0; i < (int)(prop3Dvect.size());i++){
+ if(prop3Dvect[i]->getId() == id){
+ return prop3Dvect[i];
+ }
+ }
+ throw "id not found in the data";
+ return NULL;
+ } catch (...) {
+ throw ;
+ }
}
-void VolumeRendererManager::deleteActor(int propid) throw (char *){
+// EED 2022-08-04 C++17 throw
+//void VolumeRendererManager::deleteActor(int propid) throw (char *)
+void VolumeRendererManager::deleteActor(int propid)
+{
+ try{
checkInvariant();
-
this->addRemoveActor(propid, false);
-
int i,n;
bool exit = false;
- for(i = 0; i < (int)(prop3Dvect.size())&&!exit;i++){
+ for(i = 0; i < (int)(prop3Dvect.size())&&!exit;i++)
+ {
if(prop3Dvect[i]->getId() == propid){
n=i;
exit = true;
if(exit){
VolumeRendererManagerData* data = prop3Dvect[n];
int j;
- for(j = i; j < (int)(prop3Dvect.size())-1;j++){
+ for(j = i; j < (int)(prop3Dvect.size())-1;j++)
+ {
prop3Dvect[j] = prop3Dvect[j+1];
}
delete data;
}else{
throw "id not found in the data";
}
+ } catch (...) {
+ throw ;
+ }
}
-vtkPiecewiseFunction* VolumeRendererManager::GetTransferFunction(int volumeid){
+vtkPiecewiseFunction* VolumeRendererManager::GetTransferFunction(int volumeid)
+{
return getViewData(volumeid)->GetTransferFunction();
}
-vtkColorTransferFunction* VolumeRendererManager::GetColorFunction(int volumeid){
+vtkColorTransferFunction* VolumeRendererManager::GetColorFunction(int volumeid)
+{
return getViewData(volumeid)->GetColorFunction();
}
-void VolumeRendererManager::changeCompositeMIPFunction(int id, int function) throw (char *){
- if(id == -1){
- for(unsigned i = 0; i < prop3Dvect.size(); i++)
- prop3Dvect[i]->changeCompositeMIPFunction(function);
- }else{
- getViewData(id)->changeCompositeMIPFunction(function);
- }
+// EED 2022-08-04 C++17 throw
+//void VolumeRendererManager::changeCompositeMIPFunction(int id, int function) throw (char *)
+void VolumeRendererManager::changeCompositeMIPFunction(int id, int function)
+{
+ try{
+ if(id == -1)
+ {
+ for(unsigned i = 0; i < prop3Dvect.size(); i++)
+ prop3Dvect[i]->changeCompositeMIPFunction(function);
+ }else{
+ getViewData(id)->changeCompositeMIPFunction(function);
+ }
+ } catch (...) {
+ throw ;
+ }
}
/**
type == 0 for linear interpolation
type == 1 for nearest interpolation
*/
-void VolumeRendererManager::changeInterpolationType(int type, int propid){
- if(propid == -1){
+void VolumeRendererManager::changeInterpolationType(int type, int propid)
+{
+ if(propid == -1)
+ {
for(unsigned i = 0; i < prop3Dvect.size(); i++)
+ {
prop3Dvect[i]->changeInterpolationType(type);
- }else{
+ } // for i
+ } else {
getViewData(propid)->changeInterpolationType(type);
}
}
* @param std::vector<double> value, the corresponding value for the opacity
* @param int propid, the correspoding id, by default it applies the changes to the first volume in the array
*/
-void VolumeRendererManager::setVolumeOpacity(std::vector<double> greylevel, std::vector<double> value, int propid){
- if(propid == -1){
+void VolumeRendererManager::setVolumeOpacity(std::vector<double> greylevel, std::vector<double> value, int propid)
+{
+ if(propid == -1)
+ {
for(unsigned i = 0; i < prop3Dvect.size(); i++)
+ {
prop3Dvect[i]->setVolumeOpacity(greylevel, value);
+ } // for i
}else{
getViewData(propid)->setVolumeOpacity(greylevel, value);
}
}
-void VolumeRendererManager::EnableBoundingBox(vtkRenderWindowInteractor* interactor, int propid){
- if(propid == -1){
+void VolumeRendererManager::EnableBoundingBox(vtkRenderWindowInteractor* interactor, int propid)
+{
+ if(propid == -1)
+ {
for(unsigned i = 0; i < prop3Dvect.size(); i++)
+ {
prop3Dvect[i]->EnableBoundingBox(interactor);
+ } // for i
}else{
getViewData(propid)->EnableBoundingBox(interactor);
}
}
-void VolumeRendererManager::DisableBoundingBox(int propid){
-
- if(propid == -1){
+void VolumeRendererManager::DisableBoundingBox(int propid)
+{
+ if(propid == -1)
+ {
for(unsigned i = 0; i < prop3Dvect.size(); i++)
+ {
prop3Dvect[i]->DisableBoundingBox();
+ } // for i
}else{
getViewData(propid)->DisableBoundingBox();
}
/**
** Adds a volume
**/
- int addVolume(int idTP, vtkImageData* img, std::string dataname) throw (char*);
+// EED 2022-08-04
+// int addVolume(int idTP, vtkImageData* img, std::string dataname) throw (char*);
+ int addVolume(int idTP, vtkImageData* img, std::string dataname);
/**
* @pre The image can have one or multiple components per voxel, and volume rendering is performed seprately over the
/**
** adds or removes an actor depending of the bool value
**/
- void addRemoveActor(int propid, bool addremove) throw(char*);
+// EED 2022-08-04
+// void addRemoveActor(int propid, bool addremove) throw(char*);
+ void addRemoveActor(int propid, bool addremove);
/**
** Check if the variables are setted correctly
**/
- void checkInvariant()throw(char*);
+// EED 2022-08-04
+// void checkInvariant()throw(char*);
+ void checkInvariant();
/**
** Set Volume Opacity
**/
- void setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value) throw(char*);
+// EED 2022-08-04
+// void setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value) throw(char*);
+ void setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value);
/**
** Set Volume Color
**/
- void setVolumeColor(int volid, std::vector<double> greylevel,
+// EED 2022-08-04
+// void setVolumeColor(int volid, std::vector<double> greylevel,
+// std::vector<double> red,
+// std::vector<double> green,
+// std::vector<double> blue)throw(char*);
+ void setVolumeColor(int volid, std::vector<double> greylevel,
std::vector<double> red,
std::vector<double> green,
- std::vector<double> blue)throw(char*);
+ std::vector<double> blue);
/**
** Given an id search the data in the vector
**/
- VolumeRendererManagerData* getViewData(int id)throw(char*);
+// EED 2022-08-04
+// VolumeRendererManagerData* getViewData(int id)throw(char*);
+ VolumeRendererManagerData* getViewData(int id);
- void changeCompositeMIPFunction(int id, int function) throw (char *);
+// EED 2022-08-04
+// void changeCompositeMIPFunction(int id, int function) throw (char *);
+ void changeCompositeMIPFunction(int id, int function);
/**
** Deletes given actor
**/
- void deleteActor(int volumeid)throw (char *);
+// EED 2022-08-04
+// void deleteActor(int volumeid)throw (char *);
+ void deleteActor(int volumeid);
/**
** Updates given volume
/**
** Check if the variables are setted correctly
**/
-void VolumeRendererManagerData::checkInvariant()throw (char *)
+// EED 2022-08-04 throw
+//void VolumeRendererManagerData::checkInvariant()throw (char *)
+void VolumeRendererManagerData::checkInvariant()
{
-#if (VTK_MAJOR_VERSION <= 7)
- if(!_compositeFunction)
- {
- throw "No composite function initialized";
- }
- if(!_MIPFunction)
- {
- throw "No MIP function initialized";
+ try {
+ #if (VTK_MAJOR_VERSION <= 7)
+ if(!_compositeFunction)
+ {
+ throw "No composite function initialized";
+ }
+ if(!_MIPFunction)
+ {
+ throw "No MIP function initialized";
+ }
+ #else
+ // ..
+ #endif
+
+ if(!VolumeMapper){
+ throw "No volume mapper initialized";
+ }
+ } catch (...) {
+ throw ;
}
-#else
- // ..
-#endif
-
- if(!VolumeMapper){
- throw "No volume mapper initialized";
- }
}
/**
** Check if the variables are setted correctly
**/
- void checkInvariant()throw (char *);
+// EED 2022-08-04
+// void checkInvariant()throw (char *);
+ void checkInvariant();
/**
** Updates volume
}
}
-void CutModelMainPanel::checkInvariant()throw (CutModelException){
- if(cutmanager==NULL){
- throw CutModelException("The manager is not initialize");
+// EED 2022-08-04 throw
+//void CutModelMainPanel::checkInvariant()throw (CutModelException)
+void CutModelMainPanel::checkInvariant()
+{
+ try {
+ if(cutmanager==NULL)
+ {
+ throw CutModelException("The manager is not initialize");
+ }
+ } catch (...) {
+ throw ;
}
}
-void CutModelMainPanel::showErrorDialog(std::string str){
+void CutModelMainPanel::showErrorDialog(std::string str)
+{
wxMessageDialog* diag = new wxMessageDialog(this, wxString(str.c_str(),wxConvUTF8 ), wxString(str.c_str(),wxConvUTF8 ), wxICON_ERROR);
diag->ShowModal();
}
-void CutModelMainPanel::RemoveActor(int id){
+void CutModelMainPanel::RemoveActor(int id)
+{
try{
checkInvariant();
-
if(!this->IsBeingDeleted()){
int i,j;
for(i = 0; i < (int)viewpanels.size()-1;i++){
viewpanels.pop_back();
cutmanager->RemoveActor(id);
}
-
}catch(CutModelException e){
showErrorDialog(e.getCause());
}
}
//RaC
-void CutModelMainPanel::onCheckChanged(){
-
- if(_isFirstTime==true){
+void CutModelMainPanel::onCheckChanged()
+{
+ if(_isFirstTime==true)
+ {
_isFirstTime=false;
cutmanager->InitializePolygonInteractorStyle();
}
-
if(_isCheck==false)
{
_isCheck=true;
//Draw Polygon
-
cutmanager->ParallelProjectionOn();
btnExecutePolygonCut->Enable(false);
_notebook->GetPage(0)->Enable(false);
_radioinsideout->Enable(false);
lblMessagePolygon->SetLabel(_T("Drawing polygon..."));
- }
- else
- {
+ } else {
_isCheck=false;
//Finish Drawing
cout<<"Finish Drawing"<<endl;
_radioinsideout->Enable(true);
lblMessagePolygon->SetLabel(_T("Contour saved! Click on Execute Cut"));
}
-
cutmanager->UpdatePolygon(_isCheck);
-
}
-
//RaC
void CutModelMainPanel::onExecuteCutPolygon()
{
lblMessagePolygon->SetLabel(_T("No contour drawed"));
}
-
-void CutModelMainPanel::onAddCutModel(){
+void CutModelMainPanel::onAddCutModel()
+{
try{
checkInvariant();
-
int id = addNewViewPanel();
cutmanager->onAddCutModel(id, getModelView(id));
-
_panelid++;
-
ShowCurrentPanel(id);
-
}catch(CutModelException e){
showErrorDialog(e.getCause());
}
}
_wxauimanager->Update();
}
-int CutModelMainPanel::addNewViewPanel()throw( CutModelException){
-
- CutModelView* viewpanel = new CutModelView(this,cutmanager->getImageRange());
-
- wxAuiPaneInfo paneinfo0;
- _wxauimanager->AddPane(viewpanel, paneinfo0.DefaultPane().DestroyOnClose().Centre().Bottom());
-
- viewpanel->setId(_panelid);
- viewpanels.push_back(viewpanel);
-
- return viewpanel->getId();
-
+// EED 2022-08-04 throw
+//int CutModelMainPanel::addNewViewPanel()throw( CutModelException)
+int CutModelMainPanel::addNewViewPanel()
+{
+ try {
+ CutModelView* viewpanel = new CutModelView(this,cutmanager->getImageRange());
+ wxAuiPaneInfo paneinfo0;
+ _wxauimanager->AddPane(viewpanel, paneinfo0.DefaultPane().DestroyOnClose().Centre().Bottom());
+ viewpanel->setId(_panelid);
+ viewpanels.push_back(viewpanel);
+ return viewpanel->getId();
+ } catch (...) {
+ throw ;
+ }
}
-CutModelView* CutModelMainPanel::getModelView(int id)throw( CutModelException)
+
+// EED 2022-08-04 throw
+//CutModelView* CutModelMainPanel::getModelView(int id)throw( CutModelException)
+CutModelView* CutModelMainPanel::getModelView(int id)
{
- CutModelView* current = NULL;
- int i;
- for(i = 0; i < (int)viewpanels.size();i++)
- {
- if(viewpanels[i]->getId()==id)
+ try {
+ CutModelView* current = NULL;
+ int i;
+ for(i = 0; i < (int)viewpanels.size();i++)
{
- current = viewpanels[i];
+ if(viewpanels[i]->getId()==id)
+ {
+ current = viewpanels[i];
+ }
}
+ if(current == NULL)
+ {
+ std::string s = "Id not found";
+ throw CutModelException(s);
+ }
+ return current;
+ } catch (...) {
+ throw ;
}
- if(current == NULL)
- {
- std::string s = "Id not found";
- throw CutModelException(s);
- }
- return current;
}
void CutModelMainPanel::onUndo()
- {
+{
try{
checkInvariant();
/*int result = */ cutmanager->Undo(); // result unused// JPR
}
}
-void CutModelMainPanel::ShowPopUpMenu(int id){
+void CutModelMainPanel::ShowPopUpMenu(int id)
+{
showErrorDialog("test");
}
-void CutModelMainPanel::changeColor(int id,double r,double g,double b){
-
+void CutModelMainPanel::changeColor(int id,double r,double g,double b)
+{
try{
checkInvariant();
cutmanager->changeColor(id, r, g, b);
}
}
-void CutModelMainPanel::ChangeShape(int id,int selection){
+void CutModelMainPanel::ChangeShape(int id,int selection)
+{
try{
checkInvariant();
showErrorDialog(e.getCause());
}
}
-void CutModelMainPanel::updateActorDirection(int id){
+
+void CutModelMainPanel::updateActorDirection(int id)
+{
try{
checkInvariant();
}
}
-void CutModelMainPanel::ExecuteCut(int id, double* range, bool isinside){
+void CutModelMainPanel::ExecuteCut(int id, double* range, bool isinside)
+{
try{
checkInvariant();
}
}
-void CutModelMainPanel::ExecuteAll(){
+void CutModelMainPanel::ExecuteAll()
+{
int i;
for(i = 0; i < (int)viewpanels.size(); i++){
viewpanels[i]->ExecuteCut();
}
}
-vtkImageData* CutModelMainPanel::GetResultImage(){
+vtkImageData* CutModelMainPanel::GetResultImage()
+{
try{
checkInvariant();
return cutmanager->GetResultImage();
return NULL;
}
-void CutModelMainPanel::ShowStatistics(int id){
-
+void CutModelMainPanel::ShowStatistics(int id)
+{
checkInvariant();
HistogramDialog *histo = new HistogramDialog(this, _T("Statistics"));
-
histo->initializeHistogram(cutmanager->GetResultImage());
-
histo->ShowModal();
-
delete histo;
}
-void CutModelMainPanel::SaveCutModelData(std::string filename){
+void CutModelMainPanel::SaveCutModelData(std::string filename)
+{
cutmanager->SaveCutModelData(filename);
}
-void CutModelMainPanel::LoadCutModelData(std::string filename){
+void CutModelMainPanel::LoadCutModelData(std::string filename)
+{
cutmanager->LoadCutModelData(filename);
}
-void CutModelMainPanel::SetType(int type){
+void CutModelMainPanel::SetType(int type)
+{
_type = type;
}
-int CutModelMainPanel::GetType(){
+int CutModelMainPanel::GetType()
+{
return _type;
}
-void CutModelMainPanel::addPolygonCutterTab(){
+void CutModelMainPanel::addPolygonCutterTab()
+{
wxPanel *panel = new wxPanel(_notebook);
panel->SetAutoLayout(true);
wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
panel->SetSizer(sizer);
sizer->AddSpacer(20);
-
wxCheckBox *item = new wxCheckBox(panel,10,_T("Draw Polygon"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,_T("") );
item->SetValue(false);
Connect(item->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)(&PolygonCutterEventHandlerCutModel::onCheckChanged));
sizer->Add(item, 0, wxALIGN_LEFT);
-
lblMessagePolygon = new wxStaticText(panel,30,_T("No contour drawed"),wxDefaultPosition,wxDefaultSize,0,_T("") );
sizer->Add(lblMessagePolygon, 0, wxALIGN_LEFT);
-
wxString choices0[2];
choices0[0] = _T("inside");
choices0[1] = _T("outside");
_radioinsideout = new wxRadioBox(panel,-1,_T(""), wxDefaultPosition, wxDefaultSize,2,choices0);
sizer->Add(_radioinsideout, wxALIGN_LEFT);
-
btnExecutePolygonCut = new wxButton(panel,20,_T("Execute Cut"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,_T("") );
Connect(btnExecutePolygonCut->GetId(), wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)(&PolygonCutterEventHandlerCutModel::onExecuteCutPolygon));
sizer->Add(btnExecutePolygonCut, 0, wxALIGN_LEFT);
-
_notebook->AddPage(panel, _T("Polygon Cutter"), false);
}
-void PolygonCutterEventHandlerCutModel::onCheckChanged(wxCommandEvent& event){
+void PolygonCutterEventHandlerCutModel::onCheckChanged(wxCommandEvent& event)
+{
CutModelMainPanel::getInstance()->onCheckChanged();
}
-void PolygonCutterEventHandlerCutModel::onExecuteCutPolygon(wxCommandEvent& event){
+void PolygonCutterEventHandlerCutModel::onExecuteCutPolygon(wxCommandEvent& event)
+{
CutModelMainPanel::getInstance()->onExecuteCutPolygon();
}
{
wxBitmap bitmap10(Add_xpm);
this->AddTool(10, wxString(_T("Add")),bitmap10);
-
this->AddSeparator();
-
wxBitmap bitmap20(Undo_xpm);
this->AddTool(20, wxString(_T("Undo")),bitmap20);
-
wxBitmap bitmap30(Redo_xpm);
this->AddTool(30, wxString(_T("Redo")),bitmap30);
-
this->AddSeparator();
-
wxBitmap bitmap40(OkAll_xpm);
this->AddTool(40, wxString(_T("Ok All")),bitmap40);
-
this->Realize();
-
_evthand = new ToolBarEventHandlerCutModel();
this->SetEventHandler(_evthand);
}
-ToolBarCutModel::~ToolBarCutModel(void){
+ToolBarCutModel::~ToolBarCutModel(void)
+{
}
ToolBarEventHandlerCutModel::ToolBarEventHandlerCutModel()
-: wxEvtHandler(){
+: wxEvtHandler()
+{
}
-ToolBarEventHandlerCutModel::~ToolBarEventHandlerCutModel(){
+
+ToolBarEventHandlerCutModel::~ToolBarEventHandlerCutModel()
+{
}
-void ToolBarEventHandlerCutModel::onAdd(wxCommandEvent& event){
+void ToolBarEventHandlerCutModel::onAdd(wxCommandEvent& event)
+{
CutModelMainPanel::getInstance()->onAddCutModel();
}
-void ToolBarEventHandlerCutModel::onUndo(wxCommandEvent& event){
+void ToolBarEventHandlerCutModel::onUndo(wxCommandEvent& event)
+{
CutModelMainPanel::getInstance()->onUndo();
}
-void ToolBarEventHandlerCutModel::onRedo(wxCommandEvent& event){
+void ToolBarEventHandlerCutModel::onRedo(wxCommandEvent& event)
+{
CutModelMainPanel::getInstance()->onRedo();
}
-void ToolBarEventHandlerCutModel::onExecuteAll(wxCommandEvent& event){
+void ToolBarEventHandlerCutModel::onExecuteAll(wxCommandEvent& event)
+{
CutModelMainPanel::getInstance()->ExecuteAll();
}
CutModelManager* cutmanager;
- void checkInvariant() throw( CutModelException);
+// EED 2022-08-04
+// void checkInvariant() throw( CutModelException);
+ void checkInvariant();
void showErrorDialog(std::string str);
wxAuiManager* _wxauimanager;
- int addNewViewPanel()throw( CutModelException);
+// EED 2022-08-04
+// int addNewViewPanel()throw( CutModelException);
+ int addNewViewPanel();
- CutModelView* getModelView(int id)throw( CutModelException);
+// EED 2022-08-04
+// CutModelView* getModelView(int id)throw( CutModelException);
+ CutModelView* getModelView(int id);
int _panelid;
return sizercolor;
}
-void CutModelView::checkInvariant()throw (CutModelException){
-
+// EED 2022-08-04 throw
+//void CutModelView::checkInvariant()throw (CutModelException)
+void CutModelView::checkInvariant()
+{
+ try {
+ } catch (...) {
+ throw ;
+ }
}
void CutModelView::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) { // virtual
class creaMaracasVisu_EXPORT CutModelView : public wxPanel, public vtkCommand
{
-
public:
CutModelView( wxWindow* parent,double* range);
~CutModelView( );
-
virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
-
int getId(){
return _id;
}
void setId(int id){
_id = id;
}
-
void ExecuteCut();
-
void SetCurrentColor(wxColour colour);
-
private:
-
int _id;
-
wxSlider* _sliderrange;
wxRadioBox* _radioinsideout;
//wxRadioBox* _radiocutstat;
wxStaticText* _currentcolor;
-
double* getRange();
bool isCut();
bool isInside();
-
-
-
wxSizer* getBoxControls(wxWindow* parent, double* range);
-
-
wxSizer* getActorProperties(wxWindow* parent);
wxSizer* getColorChooseActor(wxWindow* parent);
wxSizer* getOpacityActor(wxWindow* parent);
-
- void checkInvariant() throw( CutModelException);
-
+// EED 2022-08-04
+// void checkInvariant() throw( CutModelException);
+ void checkInvariant();
};
class CutModelViewEventHandler : public wxEvtHandler{
-
public:
CutModelViewEventHandler(): wxEvtHandler(){};
~CutModelViewEventHandler(){};
-
void onColorChange(wxCommandEvent& event);
void onOpacityChange(wxScrollEvent& event);
void onViewBoxChecked(wxCommandEvent& event);
void onShapeChange(wxCommandEvent& event);
void onStatistics(wxCommandEvent& event);
void onExecute(wxCommandEvent& event);
-
-
-
private:
-
};
-
#endif
//_boxWidgetVolume->GetOutlineProperty()->SetOpacity(0.5);
}
-void CutModelData::setTransform(vtkImageData* img)throw( CutModelException){
-
- currentmatrix = vtkTransform::New();
- modeltransform = vtkTransform::New();
- inversModel = vtkTransform::New();
-
- vtkMatrix4x4* matrix = vtkMatrix4x4::New();
- matrix->Identity();
- double *ori = img->GetOrigin();
- int *ext = img->GetExtent();
- double *spc = img->GetSpacing();
-
- matrix->SetElement(0,0,(ext[1]-ext[0])/4*spc[0]);
- matrix->SetElement(1,1,(ext[3]-ext[2])/4*spc[1]);
- matrix->SetElement(2,2,(ext[5]-ext[4])/4*spc[2]);
-
- double orgx = (ext[1]+ext[0])/2.*spc[0];
- double orgy = (ext[3]+ext[2])/2.*spc[1];
- double orgz = (ext[5]+ext[4])/2.*spc[2];
-
- matrix->SetElement(0,3,orgx);
- matrix->SetElement(1,3,orgy);
- matrix->SetElement(2,3,orgz);
-
- currentmatrix->SetMatrix(matrix);
- _boxWidgetVolume->SetTransform(currentmatrix);
+// EED 2022-08-04 throw
+//void CutModelData::setTransform(vtkImageData* img)throw( CutModelException)
+void CutModelData::setTransform(vtkImageData* img)
+{
+ try {
+ currentmatrix = vtkTransform::New();
+ modeltransform = vtkTransform::New();
+ inversModel = vtkTransform::New();
+ vtkMatrix4x4* matrix = vtkMatrix4x4::New();
+ matrix->Identity();
+ double *ori = img->GetOrigin();
+ int *ext = img->GetExtent();
+ double *spc = img->GetSpacing();
+ matrix->SetElement(0,0,(ext[1]-ext[0])/4*spc[0]);
+ matrix->SetElement(1,1,(ext[3]-ext[2])/4*spc[1]);
+ matrix->SetElement(2,2,(ext[5]-ext[4])/4*spc[2]);
+ double orgx = (ext[1]+ext[0])/2.*spc[0];
+ double orgy = (ext[3]+ext[2])/2.*spc[1];
+ double orgz = (ext[5]+ext[4])/2.*spc[2];
+ matrix->SetElement(0,3,orgx);
+ matrix->SetElement(1,3,orgy);
+ matrix->SetElement(2,3,orgz);
+ currentmatrix->SetMatrix(matrix);
+ _boxWidgetVolume->SetTransform(currentmatrix);
+ } catch (...) {
+ throw ;
+ }
}
void CutModelData::createActor(){
_Actor->GetProperty()->SetOpacity(0.5);
}
-void CutModelData::udapteActorDirection()throw( CutModelException){
- checkInvariant();
-
+// EED 2022-08-04 throw
+//void CutModelData::udapteActorDirection()throw( CutModelException)
+void CutModelData::udapteActorDirection()
+{
+ try {
+ checkInvariant();
_boxWidgetVolume->GetTransform(currentmatrix);
- _Actor->SetUserMatrix(currentmatrix->GetMatrix());//SetUserTransform(currentmatrix );
+ _Actor->SetUserMatrix(currentmatrix->GetMatrix()); //SetUserTransform(currentmatrix );
+ } catch (...) {
+ throw ;
+ }
}
-void CutModelData::createShapes(){
+void CutModelData::createShapes()
+{
_cubefigure = new CutModelFigureCube();
_cylinderfigure = new CutModelFigureCylinder();
_spherefigure = new CutModelFigureSphere();
}
-void CutModelData::changeOpacity(int opacity)throw( CutModelException){
- checkInvariant();
- _Actor->GetProperty()->SetOpacity((double)opacity/100.0);
+// EED 2022-08-04 throw
+//void CutModelData::changeOpacity(int opacity)throw( CutModelException)
+void CutModelData::changeOpacity(int opacity)
+{
+ try {
+ checkInvariant();
+ _Actor->GetProperty()->SetOpacity((double)opacity/100.0);
+ } catch (...) {
+ throw ;
+ }
}
-void CutModelData::ShowViewBox(bool check)throw( CutModelException){
- checkInvariant();
- if(check){
- _boxWidgetVolume->On();
- }else{
- _boxWidgetVolume->Off();
- }
+// EED 2022-08-04 throw
+//void CutModelData::ShowViewBox(bool check)throw( CutModelException)
+void CutModelData::ShowViewBox(bool check)
+{
+ try {
+ checkInvariant();
+ if(check){
+ _boxWidgetVolume->On();
+ }else{
+ _boxWidgetVolume->Off();
+ }
+ } catch (...) {
+ throw ;
+ }
}
-void CutModelData::ChangeShape(int selection)throw( CutModelException){
- checkInvariant();
-
- if(selection == 0)
- {
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- _Mapper->SetInput(_spherefigure->getPolyData());
-#else
- _Mapper->SetInputData(_spherefigure->getPolyData());
-#endif
- }else if(selection == 1){
-
-#if VTK_MAJOR_VERSION <= 5
- _Mapper->SetInput(_cylinderfigure->getPolyData());
-#else
- _Mapper->SetInputData(_cylinderfigure->getPolyData());
-#endif
-
- }else if(selection == 2){
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- _Mapper->SetInput(_cubefigure->getPolyData());
-#else
- _Mapper->SetInputData(_cubefigure->getPolyData());
-#endif
- }else{
- throw CutModelException("Shape type not found");
+// EED 2022-08-04 throw
+//void CutModelData::ChangeShape(int selection)throw( CutModelException)
+void CutModelData::ChangeShape(int selection)
+{
+ try {
+ checkInvariant();
+ if(selection == 0)
+ {
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ _Mapper->SetInput(_spherefigure->getPolyData());
+ #else
+ _Mapper->SetInputData(_spherefigure->getPolyData());
+ #endif
+ }else if(selection == 1){
+
+ #if VTK_MAJOR_VERSION <= 5
+ _Mapper->SetInput(_cylinderfigure->getPolyData());
+ #else
+ _Mapper->SetInputData(_cylinderfigure->getPolyData());
+ #endif
+
+ }else if(selection == 2){
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ _Mapper->SetInput(_cubefigure->getPolyData());
+ #else
+ _Mapper->SetInputData(_cubefigure->getPolyData());
+ #endif
+ }else{
+ throw CutModelException("Shape type not found");
+ }
+ _currentshape=selection;
+ } catch (...) {
+ throw ;
}
- _currentshape=selection;
+
}
-void CutModelData::checkInvariant()throw( CutModelException){
- if(_boxWidgetVolume==NULL){
- throw CutModelException("Box Widget not created");
- }
- if(_Mapper==NULL){
- throw CutModelException("Mapper not created");
- }
- if(_Actor==NULL){
- throw CutModelException("Actor not created");
- }
- if(_cubefigure==NULL){
- throw CutModelException("Cube not created");
- }
- if(_cylinderfigure==NULL){
- throw CutModelException("Cylinder not created");
- }
- if(_spherefigure==NULL){
- throw CutModelException("Sphere not created");
+// EED 2022-08-04 throw
+//void CutModelData::checkInvariant()throw( CutModelException)
+void CutModelData::checkInvariant()
+{
+ try {
+ if(_boxWidgetVolume==NULL){
+ throw CutModelException("Box Widget not created");
+ }
+ if(_Mapper==NULL){
+ throw CutModelException("Mapper not created");
+ }
+ if(_Actor==NULL){
+ throw CutModelException("Actor not created");
+ }
+ if(_cubefigure==NULL){
+ throw CutModelException("Cube not created");
+ }
+ if(_cylinderfigure==NULL){
+ throw CutModelException("Cylinder not created");
+ }
+ if(_spherefigure==NULL){
+ throw CutModelException("Sphere not created");
+ }
+ } catch (...) {
+ throw ;
}
}
-vtkActor* CutModelData::getActor()throw( CutModelException){
- checkInvariant();
- return _Actor;
+// EED 2022-08-04 throw
+//vtkActor* CutModelData::getActor()throw( CutModelException)
+vtkActor* CutModelData::getActor()
+{
+ try {
+ checkInvariant();
+ return _Actor;
+ } catch (...) {
+ throw ;
+ }
}
-void CutModelData::changeColor(double r,double g,double b)throw( CutModelException){
- checkInvariant();
- _Actor->GetProperty()->SetColor( r,g,b );
+// EED 2022-08-04 throw
+//void CutModelData::changeColor(double r,double g,double b)throw( CutModelException)
+void CutModelData::changeColor(double r,double g,double b)
+{
+ try {
+ checkInvariant();
+ _Actor->GetProperty()->SetColor( r,g,b );
+ } catch (...) {
+ throw ;
+ }
}
-CutModelFigure* CutModelData::getCurentCuttingModel(){
- checkInvariant();
-
+CutModelFigure* CutModelData::getCurentCuttingModel()
+{
+ checkInvariant();
if(_currentshape == 0){
return _spherefigure;
}else if(_currentshape == 1){
}
}
-void CutModelData::ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)throw( CutModelException)
+// EED 2022-08-04 throw
+//void CutModelData::ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)throw( CutModelException)
+void CutModelData::ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)
{
- wxBusyCursor wait;
-
- CutModelFigure* actualCuttingModel = getCurentCuttingModel();
-
- //_boxWidgetVolume->GetTransform(currentmatrix);
- actualCuttingModel->SetVtkTransform(getModelTransform(copyimage));
- //actualCuttingModel->SetVtkTransform(currentmatrix);
- actualCuttingModel->SetInversVtkTransform(getModelTransformInvers());
-
- bool inside;
- //bool volInt, volExt; // unused
- int xx,yy,zz;
- unsigned short* pOrg;
- int ext[6];
- //double spc[3]; // unused
- //long int contAfter = 0; // unused
- //long int contBefor = 0; // unused
-
- double minvalue = range[0];
- double value = range[1];
- double maxvalue = range[2];
-
- copyimage->GetExtent(ext);
-
- for (xx=ext[0];xx<=ext[1]; xx++)
- {
- for (yy=ext[2];yy<=ext[3]; yy++)
+ try {
+ wxBusyCursor wait;
+ CutModelFigure* actualCuttingModel = getCurentCuttingModel();
+ //_boxWidgetVolume->GetTransform(currentmatrix);
+ actualCuttingModel->SetVtkTransform(getModelTransform(copyimage));
+ //actualCuttingModel->SetVtkTransform(currentmatrix);
+ actualCuttingModel->SetInversVtkTransform(getModelTransformInvers());
+ bool inside;
+ //bool volInt, volExt; // unused
+ int xx,yy,zz;
+ unsigned short* pOrg;
+ int ext[6];
+ //double spc[3]; // unused
+ //long int contAfter = 0; // unused
+ //long int contBefor = 0; // unused
+ double minvalue = range[0];
+ double value = range[1];
+ double maxvalue = range[2];
+ copyimage->GetExtent(ext);
+ for (xx=ext[0];xx<=ext[1]; xx++)
{
- for (zz=ext[4];zz<=ext[5];zz++)
+ for (yy=ext[2];yy<=ext[3]; yy++)
{
- inside=actualCuttingModel->IfPointInside(xx,yy,zz);
- if ( ((inside==true)&&(isinside==true)) || ((!inside==true)&&(!isinside)) )
+ for (zz=ext[4];zz<=ext[5];zz++)
{
- pOrg=(unsigned short*)copyimage->GetScalarPointer (xx,yy,zz);
-
- //std::cout<<"xx,yy,zz "<<xx<<","<<yy<<","<<zz<<" "<<*pOrg<<std::endl;
- if ((unsigned short)minvalue <=(*pOrg)&&(*pOrg)<=(unsigned short)maxvalue)
- {
-
- *pOrg=(unsigned short)value;
-
- }
- } // if inside
- } // for zz
- } // for yy
- } // for xx
+ inside=actualCuttingModel->IfPointInside(xx,yy,zz);
+ if ( ((inside==true)&&(isinside==true)) || ((!inside==true)&&(!isinside)) )
+ {
+ pOrg=(unsigned short*)copyimage->GetScalarPointer (xx,yy,zz);
+
+ //std::cout<<"xx,yy,zz "<<xx<<","<<yy<<","<<zz<<" "<<*pOrg<<std::endl;
+ if ((unsigned short)minvalue <=(*pOrg)&&(*pOrg)<=(unsigned short)maxvalue)
+ {
+
+ *pOrg=(unsigned short)value;
+
+ }
+ } // if inside
+ } // for zz
+ } // for yy
+ } // for xx
+ } catch (...) {
+ throw ;
+ }
}
-void CutModelData::ExecuteUnCut(bool isinside, vtkImageData* image, vtkImageData* copyimage)throw( CutModelException)
+// EED 2022-08-04 throw
+//void CutModelData::ExecuteUnCut(bool isinside, vtkImageData* image, vtkImageData* copyimage)throw( CutModelException)
+void CutModelData::ExecuteUnCut(bool isinside, vtkImageData* image, vtkImageData* copyimage)
{
- wxBusyCursor wait;
-
- CutModelFigure* actualCuttingModel = getCurentCuttingModel();
-
- actualCuttingModel->SetVtkTransform(getModelTransform(copyimage));
-
- actualCuttingModel->SetInversVtkTransform(getModelTransformInvers());
-
- bool inside;
- // bool volInt, volExt; // unused // JPRx
- int xx,yy,zz;
- unsigned short* pOrg;
- int ext[6];
- //double spc[3]; // unused // JPRx
- //long int contAfter = 0; // unused // JPRx
- //long int contBefor = 0; // unused // JPRx
-
- double value;
-
- copyimage->GetExtent(ext);
-
- for (xx=ext[0];xx<=ext[1]; xx++)
- {
- for (yy=ext[2];yy<=ext[3]; yy++)
+ try {
+ wxBusyCursor wait;
+ CutModelFigure* actualCuttingModel = getCurentCuttingModel();
+ actualCuttingModel->SetVtkTransform(getModelTransform(copyimage));
+ actualCuttingModel->SetInversVtkTransform(getModelTransformInvers());
+ bool inside;
+ // bool volInt, volExt; // unused // JPRx
+ int xx,yy,zz;
+ unsigned short* pOrg;
+ int ext[6];
+ //double spc[3]; // unused // JPRx
+ //long int contAfter = 0; // unused // JPRx
+ //long int contBefor = 0; // unused // JPRx
+ double value;
+ copyimage->GetExtent(ext);
+ for (xx=ext[0];xx<=ext[1]; xx++)
{
- for (zz=ext[4];zz<=ext[5];zz++)
+ for (yy=ext[2];yy<=ext[3]; yy++)
{
- inside=actualCuttingModel->IfPointInside(xx,yy,zz);
- if ( ((inside==true)&&(isinside==true)) || ((!inside==true)&&(!isinside)) )
+ for (zz=ext[4];zz<=ext[5];zz++)
{
- value = *((unsigned short*)image->GetScalarPointer (xx,yy,zz));
- pOrg=(unsigned short*)copyimage->GetScalarPointer (xx,yy,zz);
- //std::cout<<"CutModelData::ExecuteUnCut() "<<value<<" "<<*pOrg<<std::endl;
- *pOrg=(unsigned short)value;
- } // if inside
- } // for zz
- } // for yy
- } // for xx
-}
+ inside=actualCuttingModel->IfPointInside(xx,yy,zz);
+ if ( ((inside==true)&&(isinside==true)) || ((!inside==true)&&(!isinside)) )
+ {
+ value = *((unsigned short*)image->GetScalarPointer (xx,yy,zz));
+ pOrg=(unsigned short*)copyimage->GetScalarPointer (xx,yy,zz);
+ //std::cout<<"CutModelData::ExecuteUnCut() "<<value<<" "<<*pOrg<<std::endl;
+ *pOrg=(unsigned short)value;
+ } // if inside
+ } // for zz
+ } // for yy
+ } // for xx
+ } catch (...) {
+ throw ;
+ }
-vtkTransform* CutModelData::getModelTransform(vtkImageData* copyimage){
+}
+vtkTransform* CutModelData::getModelTransform(vtkImageData* copyimage)
+{
double *spc = copyimage->GetSpacing();
modeltransform->Identity();
-
- vtkMatrix4x4* matrix = currentmatrix->GetMatrix();
+ vtkMatrix4x4* matrix = currentmatrix->GetMatrix();
vtkMatrix4x4* matrixmodel = modeltransform->GetMatrix();
matrixmodel->SetElement(0,0,matrix->GetElement(0,0)/spc[0]);
matrixmodel->SetElement(1,0,matrix->GetElement(1,0)/spc[0]);
matrixmodel->SetElement(0,3,matrix->GetElement(0,3)/spc[0]);
matrixmodel->SetElement(1,3,matrix->GetElement(1,3)/spc[1]);
matrixmodel->SetElement(2,3,matrix->GetElement(2,3)/spc[2]);
-
/*
double* pos = currentmatrix->GetPosition();
modeltransform->Translate(pos[0]/spc[0],pos[1]/spc[1],pos[2]/spc[2]);
-
double* scal = currentmatrix->GetScale();
modeltransform->Scale(scal[0]/spc[0],scal[1]/spc[1],scal[2]/spc[2]);
-
//double* orient = currentmatrix->GetOrientation();
//modeltransform->RotateZ(orient[2]);
//modeltransform->RotateY(orient[1]);
double* orient = currentmatrix->GetOrientationWXYZ();
modeltransform->RotateWXYZ(orient[0],orient[1],orient[2],orient[3]);
*/
-
modeltransform->Update();
-
return modeltransform;
}
-void CutModelData::setTransform(vtkTransform* transform, vtkImageData* img)throw( CutModelException){
-
-// double *spc = img->GetSpacing(); // spc unused // JPR
-
- currentmatrix->Identity();
-
- /*double* orient = transform->GetOrientationWXYZ();
- currentmatrix->RotateWXYZ(orient[0],orient[1],orient[2],orient[3]);
-
- double* pos = transform->GetPosition();
- currentmatrix->Translate(pos[0]/spc[0],pos[1]/spc[1],pos[2]/spc[2]);
-
- double* scal = transform->GetScale();
- currentmatrix->Scale(scal[0]/spc[0],scal[1]/spc[1],scal[2]/spc[2]);
-
- currentmatrix->Update(); */
-
- _boxWidgetVolume->SetTransform(transform);
-
- /*vtkMatrix4x4* matrix = transform->GetMatrix();
- vtkMatrix4x4* matrixcurrent = currentmatrix->GetMatrix();
- matrixcurrent->SetElement(0,0,matrix->GetElement(0,0)/spc[0]);
- matrixcurrent->SetElement(1,0,matrix->GetElement(1,0)/spc[0]);
- matrixcurrent->SetElement(2,0,matrix->GetElement(2,0)/spc[0]);
- matrixcurrent->SetElement(0,1,matrix->GetElement(0,1)/spc[1]);
- matrixcurrent->SetElement(1,1,matrix->GetElement(1,1)/spc[1]);
- matrixcurrent->SetElement(2,1,matrix->GetElement(2,1)/spc[1]);
- matrixcurrent->SetElement(0,2,matrix->GetElement(0,2)/spc[2]);
- matrixcurrent->SetElement(1,2,matrix->GetElement(1,2)/spc[2]);
- matrixcurrent->SetElement(2,2,matrix->GetElement(2,2)/spc[2]);
- matrixcurrent->SetElement(0,3,matrix->GetElement(0,3)/spc[0]);
- matrixcurrent->SetElement(1,3,matrix->GetElement(1,3)/spc[1]);
- matrixcurrent->SetElement(2,3,matrix->GetElement(2,3)/spc[2]); */
-
- udapteActorDirection();
- getModelTransform(img);
+// EED 2022-08-04 throw
+//void CutModelData::setTransform(vtkTransform* transform, vtkImageData* img)throw( CutModelException)
+void CutModelData::setTransform(vtkTransform* transform, vtkImageData* img)
+{
+ try {
+ // double *spc = img->GetSpacing(); // spc unused // JPR
+ currentmatrix->Identity();
+ /*double* orient = transform->GetOrientationWXYZ();
+ currentmatrix->RotateWXYZ(orient[0],orient[1],orient[2],orient[3]);
+ double* pos = transform->GetPosition();
+ currentmatrix->Translate(pos[0]/spc[0],pos[1]/spc[1],pos[2]/spc[2]);
+ double* scal = transform->GetScale();
+ currentmatrix->Scale(scal[0]/spc[0],scal[1]/spc[1],scal[2]/spc[2]);
+ currentmatrix->Update(); */
+ _boxWidgetVolume->SetTransform(transform);
+ /*vtkMatrix4x4* matrix = transform->GetMatrix();
+ vtkMatrix4x4* matrixcurrent = currentmatrix->GetMatrix();
+ matrixcurrent->SetElement(0,0,matrix->GetElement(0,0)/spc[0]);
+ matrixcurrent->SetElement(1,0,matrix->GetElement(1,0)/spc[0]);
+ matrixcurrent->SetElement(2,0,matrix->GetElement(2,0)/spc[0]);
+ matrixcurrent->SetElement(0,1,matrix->GetElement(0,1)/spc[1]);
+ matrixcurrent->SetElement(1,1,matrix->GetElement(1,1)/spc[1]);
+ matrixcurrent->SetElement(2,1,matrix->GetElement(2,1)/spc[1]);
+ matrixcurrent->SetElement(0,2,matrix->GetElement(0,2)/spc[2]);
+ matrixcurrent->SetElement(1,2,matrix->GetElement(1,2)/spc[2]);
+ matrixcurrent->SetElement(2,2,matrix->GetElement(2,2)/spc[2]);
+ matrixcurrent->SetElement(0,3,matrix->GetElement(0,3)/spc[0]);
+ matrixcurrent->SetElement(1,3,matrix->GetElement(1,3)/spc[1]);
+ matrixcurrent->SetElement(2,3,matrix->GetElement(2,3)/spc[2]); */
+ udapteActorDirection();
+ getModelTransform(img);
+ } catch (...) {
+ throw ;
+ }
}
-vtkTransform* CutModelData::getModelTransformInvers(){
- inversModel->Identity ();
- inversModel->Concatenate ( modeltransform );
- inversModel->Inverse();
- return inversModel;
+vtkTransform* CutModelData::getModelTransformInvers()
+{
+ inversModel->Identity ();
+ inversModel->Concatenate ( modeltransform );
+ inversModel->Inverse();
+ return inversModel;
}
-vtkPolyData* CutModelData::getPolyData()throw( CutModelException){
- return _Mapper->GetInput();
+// EED 2022-08-04 throw
+//vtkPolyData* CutModelData::getPolyData()throw( CutModelException)
+vtkPolyData* CutModelData::getPolyData()
+{
+ try {
+ return _Mapper->GetInput();
+ } catch (...) {
+ throw ;
+ }
}
CutModelData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img);
~CutModelData();
void initializeData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img);
-
-
int getId(){
return _id;
}
-
+// EED 2022-08-04
+/*
void changeOpacity(int opacity)throw( CutModelException);
-
void ShowViewBox(bool check)throw( CutModelException);
-
void ChangeShape(int selection)throw( CutModelException);
-
vtkActor* getActor()throw( CutModelException);
-
vtkPolyData* getPolyData()throw( CutModelException);
-
void changeColor(double r,double g,double b)throw( CutModelException);
-
void udapteActorDirection()throw( CutModelException);
-
void ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)throw( CutModelException);
-
void ExecuteUnCut( bool isinside, vtkImageData* image, vtkImageData* copyimage)throw( CutModelException);
-
+ void setTransform(vtkTransform* transform,vtkImageData* img)throw( CutModelException);
+*/
+ void changeOpacity(int opacity);
+ void ShowViewBox(bool check);
+ void ChangeShape(int selection);
+ vtkActor* getActor();
+ vtkPolyData* getPolyData();
+ void changeColor(double r,double g,double b);
+ void udapteActorDirection();
+ void ExecuteCut( double* range, bool isinside, vtkImageData* copyimage);
+ void ExecuteUnCut( bool isinside, vtkImageData* image, vtkImageData* copyimage);
+ void setTransform(vtkTransform* transform,vtkImageData* img);
+
void RefreshViewBox();
-
vtkTransform* getCurrentMatrix(){
return currentmatrix;
}
-
int getCurrentShape(){
return _currentshape;
}
-
void setCurrentShape(int currentshape){
_currentshape = currentshape;
}
-
- void setTransform(vtkTransform* transform,vtkImageData* img)throw( CutModelException);
private:
+// EED 2022-08-04
+// void checkInvariant()throw( CutModelException);
+// void setTransform(vtkImageData* img)throw( CutModelException);
+ void checkInvariant();
+ void setTransform(vtkImageData* img);
- void checkInvariant()throw( CutModelException);
-
void createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCommand* observer);
void createActor();
- void setTransform(vtkImageData* img)throw( CutModelException);
void createShapes();
-
- vtkBoxWidget* _boxWidgetVolume;
- vtkPolyDataMapper* _Mapper;
- vtkActor* _Actor;
- int _id;
-
- int _currentshape;
-
- CutModelFigureCube* _cubefigure;
- CutModelFigureCylinder* _cylinderfigure;
- CutModelFigureSphere* _spherefigure;
- vtkTransform* currentmatrix;
- vtkTransform* modeltransform;
- vtkTransform* inversModel;
-
-
- CutModelFigure* getCurentCuttingModel();
-
- vtkTransform* getModelTransform(vtkImageData* copyimage);
- vtkTransform* getModelTransformInvers();
+ vtkBoxWidget *_boxWidgetVolume;
+ vtkPolyDataMapper *_Mapper;
+ vtkActor *_Actor;
+ int _id;
+ int _currentshape;
+ CutModelFigureCube *_cubefigure;
+ CutModelFigureCylinder *_cylinderfigure;
+ CutModelFigureSphere *_spherefigure;
+ vtkTransform *currentmatrix;
+ vtkTransform *modeltransform;
+ vtkTransform *inversModel;
+ CutModelFigure* getCurentCuttingModel();
+ vtkTransform* getModelTransform(vtkImageData* copyimage);
+ vtkTransform* getModelTransformInvers();
};
#endif
_render = renderer;
}
-void CutModelManager::onAddCutModel(int id, vtkCommand* observer) throw( CutModelException){
- checkInvariant();
-
-
- CutModelData* data = new CutModelData(id,_interactor, observer, _img);
- _vectordata.push_back(data);
-
- _render->AddActor(data->getActor());
-
- //_render->UpdateCamera();
- _render->Render();
+// EED 2022-08-04 throw
+//void CutModelManager::onAddCutModel(int id, vtkCommand* observer) throw( CutModelException)
+void CutModelManager::onAddCutModel(int id, vtkCommand* observer)
+{
+ try {
+ checkInvariant();
+ CutModelData* data = new CutModelData(id,_interactor, observer, _img);
+ _vectordata.push_back(data);
+ _render->AddActor(data->getActor());
+ //_render->UpdateCamera();
+ _render->Render();
+ } catch (...) {
+ throw ;
+ }
}
-void CutModelManager::checkInvariant() throw( CutModelException){
- if(_img==NULL){
- throw CutModelException("The image is not set");
- }
- if(_img2==NULL){
- throw CutModelException("The image is not set");
- }
- if(_interactor==NULL){
- throw CutModelException("Interactor not set");
- }
- if(_render==NULL){
- throw CutModelException("Render not set");
+// EED 2022-08-04 throw
+//void CutModelManager::checkInvariant() throw( CutModelException)
+void CutModelManager::checkInvariant()
+{
+ try {
+ if(_img==NULL){
+ throw CutModelException("The image is not set");
+ }
+ if(_img2==NULL){
+ throw CutModelException("The image is not set");
+ }
+ if(_interactor==NULL){
+ throw CutModelException("Interactor not set");
+ }
+ if(_render==NULL){
+ throw CutModelException("Render not set");
+ }
+ } catch (...) {
+ throw ;
}
}
-double* CutModelManager::getImageRange()throw( CutModelException){
- checkInvariant();
- return _img->GetScalarRange();
+// EED 2022-08-04 throw
+//double* CutModelManager::getImageRange()throw( CutModelException)
+double* CutModelManager::getImageRange()
+{
+ try {
+ checkInvariant();
+ return _img->GetScalarRange();
+ } catch (...) {
+ throw ;
+ }
}
-void CutModelManager::changeOpacity(int id,int opacity)throw( CutModelException){
- checkInvariant();
- CutModelData* current = getCutModelData(id);
- current->changeOpacity(opacity);
+// EED 2022-08-04 throw
+//void CutModelManager::changeOpacity(int id,int opacity)throw( CutModelException)
+void CutModelManager::changeOpacity(int id,int opacity)
+{
+ try {
+ checkInvariant();
+ CutModelData* current = getCutModelData(id);
+ current->changeOpacity(opacity);
+ } catch (...) {
+ throw ;
+ }
}
-void CutModelManager::ShowViewBox(int id,bool check)throw( CutModelException){
- checkInvariant();
- CutModelData* current = getCutModelData(id);
- current->ShowViewBox(check);
+// EED 2022-08-04 throw
+//void CutModelManager::ShowViewBox(int id,bool check)throw( CutModelException)
+void CutModelManager::ShowViewBox(int id,bool check)
+{
+ try {
+ checkInvariant();
+ CutModelData* current = getCutModelData(id);
+ current->ShowViewBox(check);
+ } catch (...) {
+ throw ;
+ }
}
-void CutModelManager::ChangeShape(int id,int selection)throw( CutModelException){
- checkInvariant();
- CutModelData* current = getCutModelData(id);
- current->ChangeShape(selection);
- _render->Render();
+// EED 2022-08-04 throw
+//void CutModelManager::ChangeShape(int id,int selection)throw( CutModelException)
+void CutModelManager::ChangeShape(int id,int selection)
+{
+ try {
+ checkInvariant();
+ CutModelData* current = getCutModelData(id);
+ current->ChangeShape(selection);
+ _render->Render();
+ } catch (...) {
+ throw ;
+ }
}
-CutModelData* CutModelManager::getCutModelData(int id)throw( CutModelException){
-
- CutModelData* current = NULL;
- int i;
- for(i= 0; i < (int)_vectordata.size();i++)
- {
- CutModelData* temp = _vectordata[i];
- std::cout<<"id in CutModelManager:: "<<id<<std::endl;
- std::cout<<"vectordataid in CutModelManager:: "<<temp->getId()<<std::endl;
-
- if(temp->getId() == id){
- current = temp;
+// EED 2022-08-04 throw
+//CutModelData* CutModelManager::getCutModelData(int id)throw( CutModelException)
+CutModelData* CutModelManager::getCutModelData(int id)
+{
+ try {
+ CutModelData* current = NULL;
+ int i;
+ for(i= 0; i < (int)_vectordata.size();i++)
+ {
+ CutModelData* temp = _vectordata[i];
+ std::cout<<"id in CutModelManager:: "<<id<<std::endl;
+ std::cout<<"vectordataid in CutModelManager:: "<<temp->getId()<<std::endl;
+ if(temp->getId() == id)
+ {
+ current = temp;
+ }
}
+ if(current ==NULL)
+ {
+ throw CutModelException("Data not found");
+ }
+ return current;
+ } catch (...) {
+ throw ;
}
- if(current ==NULL){
-
- throw CutModelException("Data not found");
- }
- return current;
}
-void CutModelManager::updateActorDirection(int id)throw( CutModelException){
- checkInvariant();
- CutModelData* current = getCutModelData(id);
- current->udapteActorDirection();
-
+// EED 2022-08-04 throw
+//void CutModelManager::updateActorDirection(int id)throw( CutModelException)
+void CutModelManager::updateActorDirection(int id)
+{
+ try {
+ checkInvariant();
+ CutModelData* current = getCutModelData(id);
+ current->udapteActorDirection();
+ } catch (...) {
+ throw ;
+ }
}
-void CutModelManager::changeColor(int id,double r,double g,double b)throw( CutModelException){
-
- checkInvariant();
- CutModelData* current = getCutModelData(id);
- current->changeColor(r,g,b);
- _render->Render();
+// EED 2022-08-04 throw
+//void CutModelManager::changeColor(int id,double r,double g,double b)throw( CutModelException)
+void CutModelManager::changeColor(int id,double r,double g,double b)
+{
+ try {
+ checkInvariant();
+ CutModelData* current = getCutModelData(id);
+ current->changeColor(r,g,b);
+ _render->Render();
+ } catch (...) {
+ throw ;
+ }
}
-void CutModelManager::RemoveActor(int id)throw( CutModelException){
-
- checkInvariant();
- CutModelData* current = getCutModelData(id);
- int i,j;
- for(i = 0; i < (int)_vectordata.size()-1;i++)
- {
- if(_vectordata[i]->getId()==id){
- for(j = i; j < (int)_vectordata.size()-1;j++){
- _vectordata[j]=_vectordata[j+1];
+// EED 2022-08-04 throw
+//void CutModelManager::RemoveActor(int id)throw( CutModelException)
+void CutModelManager::RemoveActor(int id)
+{
+ try {
+ checkInvariant();
+ CutModelData* current = getCutModelData(id);
+ int i,j;
+ for(i = 0; i < (int)_vectordata.size()-1;i++)
+ {
+ if(_vectordata[i]->getId()==id){
+ for(j = i; j < (int)_vectordata.size()-1;j++){
+ _vectordata[j]=_vectordata[j+1];
+ }
+ i = _vectordata.size();
}
- i = _vectordata.size();
}
+ _render->RemoveViewProp(current->getActor());
+ //_render->RemoveViewProp(current->get
+ delete current;
+ _vectordata.pop_back();
+ _render->Render();
+ } catch (...) {
+ throw ;
}
- _render->RemoveViewProp(current->getActor());
- //_render->RemoveViewProp(current->get
- delete current;
- _vectordata.pop_back();
- _render->Render();
-
}
-void CutModelManager::ExecuteCut(int id, double* range, bool isinside)throw( CutModelException){
- checkInvariant();
-
- CutModelData* current = getCutModelData(id);
- current->ExecuteCut(range, isinside,_img2);
-
-
- /*
- Setting extra information for the undo
- */
- CutModelSaveBinInfo* undoaction = this->AddActionUndo(id, CUTMODEL_CUT);
- undoaction->setRange(range);
- undoaction->setIsInside(isinside);
-
+// EED 2022-08-04 throw
+//void CutModelManager::ExecuteCut(int id, double* range, bool isinside)throw( CutModelException)
+void CutModelManager::ExecuteCut(int id, double* range, bool isinside)
+{
+ try {
+ checkInvariant();
+ CutModelData* current = getCutModelData(id);
+ current->ExecuteCut(range, isinside,_img2);
+ /*
+ Setting extra information for the undo
+ */
+ CutModelSaveBinInfo* undoaction = this->AddActionUndo(id, CUTMODEL_CUT);
+ undoaction->setRange(range);
+ undoaction->setIsInside(isinside);
+ } catch (...) {
+ throw ;
+ }
}
-vtkImageData* CutModelManager::GetResultImage(){
+vtkImageData* CutModelManager::GetResultImage()
+{
checkInvariant();
return _img2;
}
-void CutModelManager::RefreshActor(int id){
+void CutModelManager::RefreshActor(int id)
+{
checkInvariant();
CutModelData* current = getCutModelData(id);
_render->RemoveActor(current->getActor());
_render->Render();
}
-void CutModelManager::SaveCutModelData(std::string filename)throw( CutModelException){
-
-
- throw CutModelException("not implemented");
-
-
-
-
-}
-
-
-
-void CutModelManager::LoadCutModelData(std::string filename)throw( CutModelException){
-
- throw CutModelException("not implemented");
-
+// EED 2022-08-04 throw
+//void CutModelManager::SaveCutModelData(std::string filename)throw( CutModelException)
+void CutModelManager::SaveCutModelData(std::string filename)
+{
+ try {
+ throw CutModelException("not implemented");
+ } catch (...) {
+ throw ;
+ }
}
-CutModelSaveBinInfo* CutModelManager::AddActionUndo(int idc, UNDOTYPE type)throw( CutModelException){
-
- for(int i = _undoredo.size()-1; i > _currentaction;i--){
- delete _undoredo[i];
- _undoredo.pop_back();
+// EED 2022-08-04 throw
+//void CutModelManager::LoadCutModelData(std::string filename)throw( CutModelException)
+void CutModelManager::LoadCutModelData(std::string filename)
+{
+ try {
+ throw CutModelException("not implemented");
+ } catch (...) {
+ throw ;
}
+}
- CutModelSaveBinInfo* cutmodel = new CutModelSaveBinInfo(idc, _currentaction, type, _path);
- if(type == CUTMODEL_CUT){
- cutmodel->saveMatrix4x4(this->getCutModelData(idc)->getCurrentMatrix()->GetMatrix());
- cutmodel->setCurrentShape(this->getCutModelData(idc)->getCurrentShape());
+// EED 2022-08-04 throw
+//CutModelSaveBinInfo* CutModelManager::AddActionUndo(int idc, UNDOTYPE type)throw( CutModelException)
+CutModelSaveBinInfo* CutModelManager::AddActionUndo(int idc, UNDOTYPE type)
+{
+ try {
+ for(int i = _undoredo.size()-1; i > _currentaction;i--)
+ {
+ delete _undoredo[i];
+ _undoredo.pop_back();
+ }
+ CutModelSaveBinInfo* cutmodel = new CutModelSaveBinInfo(idc, _currentaction, type, _path);
+ if(type == CUTMODEL_CUT){
+ cutmodel->saveMatrix4x4(this->getCutModelData(idc)->getCurrentMatrix()->GetMatrix());
+ cutmodel->setCurrentShape(this->getCutModelData(idc)->getCurrentShape());
+ }
+ _undoredo.push_back(cutmodel);
+ _currentaction++;// = _undoredo.size();
+ //std::cout<<"current index "<<_currentaction;
+ return cutmodel;
+ } catch (...) {
+ throw ;
}
-
- _undoredo.push_back(cutmodel);
-
- _currentaction++;// = _undoredo.size();
- //std::cout<<"current index "<<_currentaction;
-
- return cutmodel;
}
-int CutModelManager::Undo() throw( CutModelException){
- //&& _currentaction < _undoredo.size()
- if(_currentaction > 0){
- int tempaction = _currentaction-1;
- CutModelSaveBinInfo* currentundo = _undoredo[tempaction];
- CutModelData* currentmodel;
-
- if(currentundo->getActionType()==CUTMODEL_CUT){
- //Undo the cut
- vtkTransform* transform = currentundo->getTransformFromMatrixFile();
-
- currentmodel = getCutModelData(currentundo->getId());
-
- currentmodel->setTransform(transform, _img2);
-
- currentmodel->setCurrentShape(currentundo->getCurrentShape());
-
- currentmodel->ExecuteUnCut(currentundo->getIsInside(), _img, _img2);
-
+// EED 2022-08-04 throw
+//int CutModelManager::Undo() throw( CutModelException)
+int CutModelManager::Undo()
+{
+ try {
+ //&& _currentaction < _undoredo.size()
+ if(_currentaction > 0)
+ {
+ int tempaction = _currentaction-1;
+ CutModelSaveBinInfo* currentundo = _undoredo[tempaction];
+ CutModelData* currentmodel;
+ if(currentundo->getActionType()==CUTMODEL_CUT){
+ //Undo the cut
+ vtkTransform* transform = currentundo->getTransformFromMatrixFile();
+ currentmodel = getCutModelData(currentundo->getId());
+ currentmodel->setTransform(transform, _img2);
+ currentmodel->setCurrentShape(currentundo->getCurrentShape());
+ currentmodel->ExecuteUnCut(currentundo->getIsInside(), _img, _img2);
+ }
+ //Every thing ok
+ _currentaction--;
+ return 0;
}
- //Every thing ok
- _currentaction--;
- return 0;
+ return -1;
+ } catch (...) {
+ throw ;
}
- return -1;
}
-int CutModelManager::Redo() throw( CutModelException){
-
- if(_currentaction >= 0 && _currentaction < (int)_undoredo.size()){
-
- CutModelSaveBinInfo* currentundo = _undoredo[_currentaction];
- CutModelData* currentmodel;
-
- if(currentundo->getActionType()==CUTMODEL_CUT){
- //Redo the cut
- vtkTransform* transform = currentundo->getTransformFromMatrixFile();
- currentmodel = getCutModelData(currentundo->getId());
- currentmodel->setTransform(transform, _img2);
- currentmodel->setCurrentShape(currentundo->getCurrentShape());
- currentmodel->ExecuteCut(currentundo->getRange(), currentundo->getIsInside(), _img2);
+// EED 2022-08-04 throw
+//int CutModelManager::Redo() throw( CutModelException)
+int CutModelManager::Redo()
+{
+ try {
+ if(_currentaction >= 0 && _currentaction < (int)_undoredo.size())
+ {
+ CutModelSaveBinInfo* currentundo = _undoredo[_currentaction];
+ CutModelData* currentmodel;
+ if(currentundo->getActionType()==CUTMODEL_CUT){
+ //Redo the cut
+ vtkTransform* transform = currentundo->getTransformFromMatrixFile();
+ currentmodel = getCutModelData(currentundo->getId());
+ currentmodel->setTransform(transform, _img2);
+ currentmodel->setCurrentShape(currentundo->getCurrentShape());
+ currentmodel->ExecuteCut(currentundo->getRange(), currentundo->getIsInside(), _img2);
+ }
+ _currentaction++;
+ return 0;
}
-
- _currentaction++;
-
- return 0;
+ return -1;
+ } catch (...) {
+ throw ;
}
- return -1;
}
-void CutModelManager::ParallelProjectionOn(){
+void CutModelManager::ParallelProjectionOn()
+{
_render->GetActiveCamera()->ParallelProjectionOn();
}
-void CutModelManager::ParallelProjectionOff(){
+void CutModelManager::ParallelProjectionOff()
+{
_render->GetActiveCamera()->ParallelProjectionOff();
}
-
//RaC
void CutModelManager::UpdatePolygon(bool mode)
{
{
cutterstyle->Delete();
cutterstyle = vtkInteractorStyleCutter::New();
-
cutterstyle->SetInteractor ( _interactor );
_interactor ->SetInteractorStyle( cutterstyle );
- }
- else
- {
+ } else {
cutterstyle->VisibilityOff();
-
loop = vtkImplicitSelectionLoop::New();
mapper = vtkPolyDataMapper::New();
if(cutterstyle->Finished())
{
_render->RemoveActor(actor3D);
}
-
loop->SetLoop( cutterstyle->GetLoopPoints() );
loop->SetNormal( cutterstyle->GetDirection());
-
-
/// Printing Points
int numPoints = cutterstyle->GetLoopPoints()->GetNumberOfPoints();
contourDirection = cutterstyle->GetDirection();
cout<<"Initial Point:"<<t<<" XX:"<<point[0]<<" YY:"<<point[1]<<" ZZ:"<<point[2]<<endl;
}
cout<<endl;
-
sample = vtkSampleFunction::New();
-
sample->SetImplicitFunction(loop);
sample->CappingOn();
-
contour = vtkContourFilter::New();
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
contour->SetInputData((vtkDataObject *)sample->GetOutput());
#endif
contour->SetValue(0,1);
-
actor = contour->GetOutput();
-
actor3D = vtkActor::New();
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
actor3D->SetMapper( mapper);
_render->AddActor(actor3D);
}
-
interactorstyle->SetInteractor ( _interactor );
_interactor->SetInteractorStyle( interactorstyle );
}
-
_interactor->Render();
_render->ResetCameraClippingRange();
}
-void CutModelManager::ExecuteCutPolygon(bool inOutCut){
+void CutModelManager::ExecuteCutPolygon(bool inOutCut)
+{
_polygonCutter->setInImage(_img2);
_polygonCutter->setPoints(contourPoints);
_polygonCutter->setDirection(contourDirection);
_polygonCutter->processOutImage(inOutCut);
}
-void CutModelManager::InitializePolygonInteractorStyle(){
-
+void CutModelManager::InitializePolygonInteractorStyle()
+{
cutterstyle = vtkInteractorStyleCutter::New();
interactorstyle = vtkInteractorStyleTrackballCamera ::New();
interactorstyle->SetInteractor ( _interactor );
void setBaseView(wxVtkBaseView* baseView);
+// EED 2022-08-04
+/*
void onAddCutModel(int id, vtkCommand* observer) throw( CutModelException);
-
double* getImageRange()throw( CutModelException);
-
void changeOpacity(int id,int opacity)throw( CutModelException);
-
void ShowViewBox(int id,bool check)throw( CutModelException);
-
void ChangeShape(int id,int selection)throw( CutModelException);
-
void changeColor(int id,double r,double g,double b)throw( CutModelException);
-
void updateActorDirection(int id)throw( CutModelException);
-
void RemoveActor(int id)throw( CutModelException);
-
void ExecuteCut(int id, double* range, bool isinside)throw( CutModelException);
-
- vtkImageData* GetResultImage();
-
- void RefreshActor(int id);
-
void SaveCutModelData(std::string filename)throw( CutModelException);
-
void LoadCutModelData(std::string filename)throw( CutModelException);
-
CutModelSaveBinInfo* AddActionUndo(int id, UNDOTYPE type)throw( CutModelException);
-
int Undo()throw( CutModelException);
-
int Redo()throw( CutModelException);
-
+*/
+ void onAddCutModel(int id, vtkCommand* observer);
+ double* getImageRange();
+ void changeOpacity(int id,int opacity);
+ void ShowViewBox(int id,bool check);
+ void ChangeShape(int id,int selection);
+ void changeColor(int id,double r,double g,double b);
+ void updateActorDirection(int id);
+ void RemoveActor(int id);
+ void ExecuteCut(int id, double* range, bool isinside);
+ void SaveCutModelData(std::string filename);
+ void LoadCutModelData(std::string filename);
+ CutModelSaveBinInfo* AddActionUndo(int id, UNDOTYPE type);
+ int Undo();
+ int Redo();
+
+ vtkImageData* GetResultImage();
+ void RefreshActor(int id);
void ParallelProjectionOn();
void ParallelProjectionOff();
int _currentaction;
- void checkInvariant() throw( CutModelException);
+// EED 2022-08-04
+// void checkInvariant() throw( CutModelException);
+ void checkInvariant();
std::string _path;
vtkImageData* _img;
vtkImageData* _img2;
std::vector<CutModelData*> _vectordata;
std::vector<CutModelSaveBinInfo*> _undoredo;
- CutModelData* getCutModelData(int id)throw( CutModelException);
+// EED 2022-08-04
+// CutModelData* getCutModelData(int id)throw( CutModelException);
+ CutModelData* getCutModelData(int id);
CutModelPolygon* _polygonCutter;
vtkPoints *contourPoints ;
/**
** Start of the manager class
**/
-CutModelSaveBinInfo::CutModelSaveBinInfo(int id, int currentaction, UNDOTYPE actiontype, std::string path){
-
+CutModelSaveBinInfo::CutModelSaveBinInfo(int id, int currentaction, UNDOTYPE actiontype, std::string path)
+{
_id = id;
-
char c[100];
sprintf(c,"/infounrd_%d_fig_%d.info",currentaction,id);
-
_stdFilename = path;
_stdFilename+=c;
_stdFilename+=".poly";
-
_matrixFilename = path;
_matrixFilename+=c;
_actiontype = actiontype;
-
-
}
-CutModelSaveBinInfo::~CutModelSaveBinInfo(){
-
+
+CutModelSaveBinInfo::~CutModelSaveBinInfo()
+{
}
-void CutModelSaveBinInfo::savePolyData(vtkPolyData* polydata){
+
+void CutModelSaveBinInfo::savePolyData(vtkPolyData* polydata)
+{
vtkPolyDataWriter * writer = vtkPolyDataWriter ::New();
writer->SetFileName(_stdFilename.c_str());
-
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
writer->SetInput(polydata);
writer->Delete();
}
-vtkTransform* CutModelSaveBinInfo::getPolyDataTransform()throw( CutModelException){
- vtkPolyDataReader* reader = vtkPolyDataReader::New();
- //std::cout<<"filename vtkTransform* CutModelSaveBinInfo::getPolyDataTransform()"<<this->getSTDFileName()<<std::endl;
- reader->SetFileName(this->getSTDFileName().c_str());
- vtkPolyData* poly = reader->GetOutput();
-
- vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- mapper->SetInput(poly);
-#else
- mapper->SetInputData(poly);
-#endif
- vtkActor* actor = vtkActor::New();
- actor->SetMapper(mapper);
- vtkMatrix4x4* actmatrix = actor->GetMatrix();
-
- std::cout<<"tkTransform* CutModelSaveBinInfo::getPolyDataTransform() Actor "<<actor<<std::endl;
- std::cout<<"tkTransform* CutModelSaveBinInfo::getPolyDataTransform() Actor Matrix "<<actmatrix<<std::endl;
-
- mapper->Update();
-
- vtkTransform* transform = vtkTransform::New();
-
- transform->Identity();
-
- transform->GetMatrix()->SetElement(0,0,actmatrix->GetElement(0,0));
- transform->GetMatrix()->SetElement(1,0,actmatrix->GetElement(1,0));
- transform->GetMatrix()->SetElement(2,0,actmatrix->GetElement(2,0));
- transform->GetMatrix()->SetElement(0,1,actmatrix->GetElement(0,1));
- transform->GetMatrix()->SetElement(1,1,actmatrix->GetElement(1,1));
- transform->GetMatrix()->SetElement(2,1,actmatrix->GetElement(2,1));
- transform->GetMatrix()->SetElement(0,2,actmatrix->GetElement(0,2));
- transform->GetMatrix()->SetElement(1,2,actmatrix->GetElement(1,2));
- transform->GetMatrix()->SetElement(2,2,actmatrix->GetElement(2,2));
- transform->GetMatrix()->SetElement(0,3,actmatrix->GetElement(0,3));
- transform->GetMatrix()->SetElement(1,3,actmatrix->GetElement(1,3));
- transform->GetMatrix()->SetElement(2,3,actmatrix->GetElement(2,3));
-
- actor->Delete();
- mapper->Delete();
- reader->Delete();
- //poly->Delete();
-
-
- return transform;
-
+// EED 2022-08-04 throw
+//vtkTransform* CutModelSaveBinInfo::getPolyDataTransform()throw( CutModelException)
+vtkTransform* CutModelSaveBinInfo::getPolyDataTransform()
+{
+ try {
+ vtkPolyDataReader* reader = vtkPolyDataReader::New();
+ //std::cout<<"filename vtkTransform* CutModelSaveBinInfo::getPolyDataTransform()"<<this->getSTDFileName()<<std::endl;
+ reader->SetFileName(this->getSTDFileName().c_str());
+ vtkPolyData* poly = reader->GetOutput();
+
+ vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ mapper->SetInput(poly);
+ #else
+ mapper->SetInputData(poly);
+ #endif
+ vtkActor* actor = vtkActor::New();
+ actor->SetMapper(mapper);
+ vtkMatrix4x4* actmatrix = actor->GetMatrix();
+
+ std::cout<<"tkTransform* CutModelSaveBinInfo::getPolyDataTransform() Actor "<<actor<<std::endl;
+ std::cout<<"tkTransform* CutModelSaveBinInfo::getPolyDataTransform() Actor Matrix "<<actmatrix<<std::endl;
+
+ mapper->Update();
+
+ vtkTransform* transform = vtkTransform::New();
+
+ transform->Identity();
+
+ transform->GetMatrix()->SetElement(0,0,actmatrix->GetElement(0,0));
+ transform->GetMatrix()->SetElement(1,0,actmatrix->GetElement(1,0));
+ transform->GetMatrix()->SetElement(2,0,actmatrix->GetElement(2,0));
+ transform->GetMatrix()->SetElement(0,1,actmatrix->GetElement(0,1));
+ transform->GetMatrix()->SetElement(1,1,actmatrix->GetElement(1,1));
+ transform->GetMatrix()->SetElement(2,1,actmatrix->GetElement(2,1));
+ transform->GetMatrix()->SetElement(0,2,actmatrix->GetElement(0,2));
+ transform->GetMatrix()->SetElement(1,2,actmatrix->GetElement(1,2));
+ transform->GetMatrix()->SetElement(2,2,actmatrix->GetElement(2,2));
+ transform->GetMatrix()->SetElement(0,3,actmatrix->GetElement(0,3));
+ transform->GetMatrix()->SetElement(1,3,actmatrix->GetElement(1,3));
+ transform->GetMatrix()->SetElement(2,3,actmatrix->GetElement(2,3));
+
+ actor->Delete();
+ mapper->Delete();
+ reader->Delete();
+ //poly->Delete();
+ return transform;
+ } catch (...) {
+ throw ;
+ }
}
-
-void CutModelSaveBinInfo::saveMatrix4x4(vtkMatrix4x4* matrix){
+void CutModelSaveBinInfo::saveMatrix4x4(vtkMatrix4x4* matrix)
+{
fstream binary_file(_matrixFilename.c_str(),ios::out|ios::binary);
binary_file.write(reinterpret_cast<char *>(matrix),sizeof(vtkMatrix4x4));
binary_file.close();
}
-vtkTransform* CutModelSaveBinInfo::getTransformFromMatrixFile()throw( CutModelException){
- vtkMatrix4x4* matrix = vtkMatrix4x4::New();
- fstream binary_file(_matrixFilename.c_str(),ios::binary|ios::in);
- binary_file.read(reinterpret_cast<char *>(matrix),sizeof(vtkMatrix4x4));
- binary_file.close();
- vtkTransform* transform = vtkTransform::New();
- transform->SetMatrix(matrix);
+// EED 2022-08-04 throw
+//vtkTransform* CutModelSaveBinInfo::getTransformFromMatrixFile()throw( CutModelException)
+vtkTransform* CutModelSaveBinInfo::getTransformFromMatrixFile()
+{
+ try {
+ vtkMatrix4x4* matrix = vtkMatrix4x4::New();
+ fstream binary_file(_matrixFilename.c_str(),ios::binary|ios::in);
+ binary_file.read(reinterpret_cast<char *>(matrix),sizeof(vtkMatrix4x4));
+ binary_file.close();
+ vtkTransform* transform = vtkTransform::New();
+ transform->SetMatrix(matrix);
+ return transform;
+ } catch (...) {
+ throw ;
+ }
+}
- return transform;
+// EED 2022-08-04 throw
+//std::string CutModelSaveBinInfo::getSTDFileName()throw( CutModelException)
+std::string CutModelSaveBinInfo::getSTDFileName()
+{
+ try {
+ if(_stdFilename=="")
+ {
+ throw new CutModelException("Filename undoredo does not exists");
+ }
+ return _stdFilename;
+ } catch (...) {
+ throw ;
+ }
}
+
UNDOTYPE getActionType(){
return _actiontype;
}
- std::string getSTDFileName()throw( CutModelException){
- if(_stdFilename==""){
- throw new CutModelException("Filename undoredo does not exists");
- }
- return _stdFilename;
- }
+
+// EED 2022-08-04
+// std::string getSTDFileName()throw( CutModelException);
+// std::string getSTDFileName()throw( CutModelException){
+// if(_stdFilename==""){
+// throw new CutModelException("Filename undoredo does not exists");
+// }
+// return _stdFilename;
+// }
+ std::string getSTDFileName();
+
/*void setSTDFileName(std::string filename){
_stdFilename = filename;
void savePolyData(vtkPolyData* polydata);
- vtkTransform* getPolyDataTransform()throw( CutModelException);
+// EED 2022-08-04
+// vtkTransform* getPolyDataTransform()throw( CutModelException);
+// vtkTransform* getTransformFromMatrixFile()throw( CutModelException);
+ vtkTransform* getPolyDataTransform();
+ vtkTransform* getTransformFromMatrixFile();
+
void saveMatrix4x4(vtkMatrix4x4* matrix);
- vtkTransform* getTransformFromMatrixFile()throw( CutModelException);
void setRange(double* range){
_range = range;
manager->SetVectors(lstPointsx,lstPointsy,lstPointsz);
}
-void PlaneDirectionViewer::UpdateDirections() throw (std::exception){
+// EED 2022-08-04 throw
+//void PlaneDirectionViewer::UpdateDirections() throw (std::exception)
+void PlaneDirectionViewer::UpdateDirections()
+{
manager->UpdateDirections();
std::vector<PlaneDirectionManagerData*> vectdata = manager->GetPlanesData();
int i;
public:
PlaneDirectionViewer(wxWindow* parent, int radio, double colour[3], int opacity);
~PlaneDirectionViewer();
-
void SetRenderer(vtkRenderer* render);
void SetVectors( std::vector<double> lstPointsx, std::vector<double> lstPointsy, std::vector<double> lstPointsz);
-
- void UpdateDirections() throw (std::exception);
-
+
+// EED 2022-08-04 throw
+// void UpdateDirections() throw (std::exception);
+ void UpdateDirections();
+
static PlaneDirectionViewer* getInstance(wxWindow* parent,int radio, double colour[3], int opacity);
-
static PlaneDirectionViewer* getInstance();
-
void addRemoveActor(int index, bool addremove);
-
void changeColor(int index,double r,double g,double b);
-
void WriteInformation(std::string filename,double* spc=NULL);
-
void SetArrowSize(int arrowsize);
private:
static PlaneDirectionViewer* instance;
Get Point list of the funcion
@param return points
*/
- virtual wxList* GetPointsPtr(){ }
+ virtual wxList* GetPointsPtr(){ return NULL; }
#endif
/**
** Adds a prop3D to the manager and returns the identifier
**/
-int wxMaracasMultipleVolumeRendererManager::addVolume(int idTP, vtkImageData* vol, std::string dataname) throw(char*){
- checkInvariant();
- image = vol;
- if(vol != NULL){
- wxMaracasMultipleVolumeRendererManagerData* data = new wxMaracasMultipleVolumeRendererManagerData(vol, dataname);
- prop3Dvect.push_back(data);
- _renderer->AddActor(data->getProp3D());
- if(idTP == -1)
- {
- data->setId(_idCount);
- _idCount++;
- }
- else
- {
- data->setId(idTP);
+// EED 2022-08-04 throw
+//int wxMaracasMultipleVolumeRendererManager::addVolume(int idTP, vtkImageData* vol, std::string dataname) throw(char*)
+int wxMaracasMultipleVolumeRendererManager::addVolume(int idTP, vtkImageData* vol, std::string dataname)
+{
+ try {
+ checkInvariant();
+ image = vol;
+ if(vol != NULL){
+ wxMaracasMultipleVolumeRendererManagerData* data = new wxMaracasMultipleVolumeRendererManagerData(vol, dataname);
+ prop3Dvect.push_back(data);
+ _renderer->AddActor(data->getProp3D());
+ if(idTP == -1)
+ {
+ data->setId(_idCount);
+ _idCount++;
+ }
+ else
+ {
+ data->setId(idTP);
+ }
+ printf("wxMaracasMultipleVolumeRendererManager::addVolume->idVolumeRenderer: %i\n", data->getId());
+ return data->getId();
+ }else{
+ throw "Check mhd imagefile file or input";
}
- printf("wxMaracasMultipleVolumeRendererManager::addVolume->idVolumeRenderer: %i\n", data->getId());
- return data->getId();
- }else{
- throw "Check mhd imagefile file or input";
+ return -1;
+ } catch (...) {
+ throw ;
}
- return -1;
}
/**
** adds or removes an actor depending of the bool value
**/
-void wxMaracasMultipleVolumeRendererManager::addRemoveActor(int propid, bool addremove) throw(char*)
+// EED 2022-08-04 throw
+//void wxMaracasMultipleVolumeRendererManager::addRemoveActor(int propid, bool addremove) throw(char*)
+void wxMaracasMultipleVolumeRendererManager::addRemoveActor(int propid, bool addremove)
{
- checkInvariant();
-
- wxMaracasMultipleVolumeRendererManagerData* data = this->getViewData(propid);
- if(data->getProp3D()!=NULL){
- if(addremove){
- _renderer->AddViewProp(data->getProp3D());
- }else{
- _renderer->RemoveViewProp(data->getProp3D());
- }
- _renderer->GetRenderWindow()->Render();
- }
-
+ try {
+ checkInvariant();
+ wxMaracasMultipleVolumeRendererManagerData* data = this->getViewData(propid);
+ if(data->getProp3D()!=NULL){
+ if(addremove){
+ _renderer->AddViewProp(data->getProp3D());
+ }else{
+ _renderer->RemoveViewProp(data->getProp3D());
+ }
+ _renderer->GetRenderWindow()->Render();
+ }
+ } catch (...) {
+ throw ;
+ }
}
/**
** Changes the opacity in a prop3D
**/
-void wxMaracasMultipleVolumeRendererManager::setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value) throw(char*)
+// EED 2022-08-04 throw
+// void wxMaracasMultipleVolumeRendererManager::setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value) throw(char*)
+void wxMaracasMultipleVolumeRendererManager::setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value)
{
- checkInvariant();
-
- this->getViewData(propid)->setVolumeOpacity(greylevel, value);
-
- _renderer->GetRenderWindow()->Render();
-
+ try {
+ checkInvariant();
+ this->getViewData(propid)->setVolumeOpacity(greylevel, value);
+ _renderer->GetRenderWindow()->Render();
+ } catch (...) {
+ throw ;
+ }
}
/**
** Set Volume Color
**/
+// EED 2022-08-04 throw
+//void wxMaracasMultipleVolumeRendererManager::setVolumeColor(int volid, std::vector<double> greylevel,
+// std::vector<double> red,
+// std::vector<double> green,
+// std::vector<double> blue)throw(char*)
void wxMaracasMultipleVolumeRendererManager::setVolumeColor(int volid, std::vector<double> greylevel,
std::vector<double> red,
std::vector<double> green,
- std::vector<double> blue)throw(char*)
+ std::vector<double> blue)
{
- checkInvariant();
-
- this->getViewData(volid)->setVolumeColor(greylevel, red, green, blue);
-
- _renderer->GetRenderWindow()->Render();
+ try {
+ checkInvariant();
+ this->getViewData(volid)->setVolumeColor(greylevel, red, green, blue);
+ _renderer->GetRenderWindow()->Render();
+ } catch (...) {
+ throw ;
+ }
}
return NULL;
}
-
vtkImageData* wxMaracasMultipleVolumeRendererManager::getImageData()
{
return image;
}
-
-void wxMaracasMultipleVolumeRendererManager::checkInvariant() throw(char*)
+// EED 2022-08-04 throw
+//void wxMaracasMultipleVolumeRendererManager::checkInvariant() throw(char*)
+void wxMaracasMultipleVolumeRendererManager::checkInvariant()
{
- if(this->_renderer==NULL){
- throw "Renderer not set";
- }
+ try {
+ if(this->_renderer==NULL)
+ {
+ throw "Renderer not set";
+ }
+ } catch (...) {
+ throw ;
+ }
}
-
-wxMaracasMultipleVolumeRendererManagerData* wxMaracasMultipleVolumeRendererManager::getViewData(int id) throw(char*)
+// EED 2022-08-04 throw
+//wxMaracasMultipleVolumeRendererManagerData* wxMaracasMultipleVolumeRendererManager::getViewData(int id) throw(char*)
+wxMaracasMultipleVolumeRendererManagerData* wxMaracasMultipleVolumeRendererManager::getViewData(int id)
{
- int i;
- for(i = 0; i < (int)(prop3Dvect.size());i++){
- if(prop3Dvect[i]->getId() == id){
- return prop3Dvect[i];
+ try {
+ int i;
+ for(i = 0; i < (int)(prop3Dvect.size());i++){
+ if(prop3Dvect[i]->getId() == id){
+ return prop3Dvect[i];
+ }
}
- }
- throw "id not found in the data";
-
- return NULL;
+ throw "id not found in the data";
+ return NULL;
+ } catch (...) {
+ throw ;
+ }
}
-
-void wxMaracasMultipleVolumeRendererManager::deleteActor(int propid) throw (char *)
+// EED 2022-08-04 throw
+//void wxMaracasMultipleVolumeRendererManager::deleteActor(int propid) throw (char *)
+void wxMaracasMultipleVolumeRendererManager::deleteActor(int propid)
{
- checkInvariant();
-
- this->addRemoveActor(propid, false);
-
- int i,n;
- bool exit = false;
- for(i = 0; i < (int)(prop3Dvect.size())&&!exit;i++){
- if(prop3Dvect[i]->getId() == propid){
- n=i;
- exit = true;
+ try {
+ checkInvariant();
+ this->addRemoveActor(propid, false);
+ int i,n;
+ bool exit = false;
+ for(i = 0; i < (int)(prop3Dvect.size())&&!exit;i++){
+ if(prop3Dvect[i]->getId() == propid){
+ n=i;
+ exit = true;
+ }
}
- }
- if(exit){
- wxMaracasMultipleVolumeRendererManagerData* data = prop3Dvect[n];
- int j;
- for(j = i; j < (int)(prop3Dvect.size())-1;j++){
- prop3Dvect[j] = prop3Dvect[j+1];
- }
- delete data;
- prop3Dvect.pop_back();
- }else{
- throw "id not found in the data";
+ if(exit){
+ wxMaracasMultipleVolumeRendererManagerData* data = prop3Dvect[n];
+ int j;
+ for(j = i; j < (int)(prop3Dvect.size())-1;j++){
+ prop3Dvect[j] = prop3Dvect[j+1];
+ }
+ delete data;
+ prop3Dvect.pop_back();
+ }else{
+ throw "id not found in the data";
+ }
+ } catch (...) {
+ throw ;
}
-
}
-
vtkPiecewiseFunction* wxMaracasMultipleVolumeRendererManager::GetTransferFunction(int volumeid)
{
return getViewData(volumeid)->GetTransferFunction();
}
-
vtkColorTransferFunction* wxMaracasMultipleVolumeRendererManager::GetColorFunction(int volumeid)
{
-
return getViewData(volumeid)->GetColorFunction();
}
-void wxMaracasMultipleVolumeRendererManager::changeCompositeMIPFunction(int id, int function) throw (char *)
+// EED 2022-08-04 throw
+//void wxMaracasMultipleVolumeRendererManager::changeCompositeMIPFunction(int id, int function) throw (char *)
+void wxMaracasMultipleVolumeRendererManager::changeCompositeMIPFunction(int id, int function)
{
- getViewData(id)->changeCompositeMIPFunction(function);
- Update(id);
+ try {
+ getViewData(id)->changeCompositeMIPFunction(function);
+ Update(id);
+ } catch (...) {
+ throw ;
+ }
}
/**
** Adds a volume
**/
- int addVolume(int idTP, vtkImageData* img, std::string dataname) throw (char*);
+// EED 2022-08-04 throw
+// int addVolume(int idTP, vtkImageData* img, std::string dataname) throw (char*);
+ int addVolume(int idTP, vtkImageData* img, std::string dataname);
/**
** loads a prop3D from a nSTL file
/**
** adds or removes an actor depending of the bool value
**/
- void addRemoveActor(int propid, bool addremove) throw(char*);
-
+// EED 2022-08-04 throw
+// void addRemoveActor(int propid, bool addremove) throw(char*);
+ void addRemoveActor(int propid, bool addremove);
+
/**
** Check if the variables are setted correctly
**/
- void checkInvariant()throw(char*);
+// EED 2022-08-04 throw
+// void checkInvariant()throw(char*);
+ void checkInvariant();
/**
** Set Volume Opacity
**/
- void setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value) throw(char*);
+// EED 2022-08-04 throw
+// void setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value) throw(char*);
+ void setVolumeOpacity(int propid, std::vector<double> greylevel,std::vector<double> value);
/**
** Set Volume Color
**/
+// EED 2022-08-04 throw
+// void setVolumeColor(int volid, std::vector<double> greylevel,
+// std::vector<double> red,
+// std::vector<double> green,
+// std::vector<double> blue)throw(char*);
void setVolumeColor(int volid, std::vector<double> greylevel,
std::vector<double> red,
std::vector<double> green,
- std::vector<double> blue)throw(char*);
+ std::vector<double> blue);
/**
** Given an id search the data in the vector
**/
- wxMaracasMultipleVolumeRendererManagerData* getViewData(int id)throw(char*);
+// EED 2022-08-04 throw
+// wxMaracasMultipleVolumeRendererManagerData* getViewData(int id)throw(char*);
+ wxMaracasMultipleVolumeRendererManagerData* getViewData(int id);
- void changeCompositeMIPFunction(int id, int function) throw (char *);
+// EED 2022-08-04 throw
+// void changeCompositeMIPFunction(int id, int function) throw (char *);
+ void changeCompositeMIPFunction(int id, int function) ;
/**
** Deletes given actor
**/
- void deleteActor(int volumeid)throw (char *);
+// EED 2022-08-04 throw
+// void deleteActor(int volumeid)throw (char *);
+ void deleteActor(int volumeid);
/**
** Updates given volume
}
-wxMaracasMultipleVolumeRendererManagerData::~wxMaracasMultipleVolumeRendererManagerData(){
-
+wxMaracasMultipleVolumeRendererManagerData::~wxMaracasMultipleVolumeRendererManagerData()
+{
_tfun->Delete();
_ctfun->Delete();
_volumePlanes->Delete();
-
-
#if (VTK_MAJOR_VERSION <= 7)
_compositeFunction->Delete();
#else
// ..
#endif
-
_volumeMapper->Delete();
_volumeProperty->Delete();
_newvol->Delete();
-
}
/**
** Set Volume Color
/**
** Volume Opacity
**/
-void wxMaracasMultipleVolumeRendererManagerData::setVolumeOpacity(std::vector<double> greylevel,std::vector<double> value){
-
+void wxMaracasMultipleVolumeRendererManagerData::setVolumeOpacity(std::vector<double> greylevel,std::vector<double> value)
+{
_tfun->RemoveAllPoints();
for(int i = 0; i < greylevel.size();i++){
_tfun->AddPoint(greylevel[i], value[i]);
/**
** Check if the variables are setted correctly
**/
-void wxMaracasMultipleVolumeRendererManagerData::checkInvariant()throw (char *)
-{
-
-
-#if (VTK_MAJOR_VERSION <= 7)
- if(!_compositeFunction)
- {
- throw "No composite function initialized";
- }
- if(!_MIPFunction)
- {
- throw "No MIP function initialized";
- }
-#else
- // ..
-#endif
- if(!_volumeMapper)
- {
- throw "No volume mapper initialized";
+// EED 2022-08-04 throw
+//void wxMaracasMultipleVolumeRendererManagerData::checkInvariant()throw (char *)
+void wxMaracasMultipleVolumeRendererManagerData::checkInvariant()
+{
+ try {
+ #if (VTK_MAJOR_VERSION <= 7)
+ if(!_compositeFunction)
+ {
+ throw "No composite function initialized";
+ }
+ if(!_MIPFunction)
+ {
+ throw "No MIP function initialized";
+ }
+ #else
+ // ..
+ #endif
+ if(!_volumeMapper)
+ {
+ throw "No volume mapper initialized";
+ }
+ } catch (...) {
+ throw ;
}
}
_dataname = dataname;
}
-void wxMaracasMultipleVolumeRendererManagerData::changeCompositeMIPFunction(int function) throw (char *)
+// EED 2022-08-04 throw
+//void wxMaracasMultipleVolumeRendererManagerData::changeCompositeMIPFunction(int function) throw (char *)
+void wxMaracasMultipleVolumeRendererManagerData::changeCompositeMIPFunction(int function)
{
- checkInvariant();
-#if (VTK_MAJOR_VERSION <= 7)
- if(function == 0)
- {
- _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
- }else{
- _volumeMapper->SetVolumeRayCastFunction(_MIPFunction);
+ try {
+ checkInvariant();
+ #if (VTK_MAJOR_VERSION <= 7)
+ if(function == 0)
+ {
+ _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
+ }else{
+ _volumeMapper->SetVolumeRayCastFunction(_MIPFunction);
+ }
+ #else
+ printf("EED wxMaracasMultipleVolumeRendererManagerData::changeCompositeMIPFunction Composite MIP ..... ??");
+ #endif
+ } catch (...) {
+ throw ;
}
-#else
- printf("EED wxMaracasMultipleVolumeRendererManagerData::changeCompositeMIPFunction Composite MIP ..... ??");
-#endif
}
+
/**
** Check if the variables are setted correctly
**/
- void checkInvariant()throw (char *);
+// EED 2022-08-04 throw
+// void checkInvariant()throw (char *);
+ void checkInvariant();
/**
** Updates volume
** Volume Opacity
**/
void setVolumeOpacity(std::vector<double> greylevel,std::vector<double> value);
-
- vtkPiecewiseFunction* GetTransferFunction(){
- return _tfun;
- }
-
- vtkColorTransferFunction* GetColorFunction(){
- return _ctfun;
- }
-
- void changeCompositeMIPFunction(int function) throw (char *);
+ vtkPiecewiseFunction* GetTransferFunction(){ return _tfun; }
+ vtkColorTransferFunction* GetColorFunction(){ return _ctfun; }
+
+// EED 2022-08-04 throw
+// void changeCompositeMIPFunction(int function) throw (char *);
+ void changeCompositeMIPFunction(int function) ;
protected:
/**
* Dataname given by the user (ex. filename)
**/
std::string _dataname;
-
-
private:
-
/*
* id of the data
*/
int _id;
-
-
-
vtkPlanes *_volumePlanes;
vtkVolumeProperty *_volumeProperty;
vtkVolume *_newvol;
vtkPiecewiseFunction *_tfun;
vtkColorTransferFunction *_ctfun;
-
#if (VTK_MAJOR_VERSION <= 7)
vtkVolumeRayCastMIPFunction *_MIPFunction;
vtkVolumeRayCastCompositeFunction *_compositeFunction;
#else
vtkFixedPointVolumeRayCastMapper *_volumeMapper;
#endif
-
-
-
};
#endif /*wxMaracasMultipleVolumeRendererManagerData_H_*/
/**
** Updates each Matrix
**/
-void wxMaracasRenderImageTransformation::Refresh()throw(char*)
+// EED 2022-08-04 throw
+//void wxMaracasRenderImageTransformation::Refresh()throw(char*)
+void wxMaracasRenderImageTransformation::Refresh()
{
- transformV->Update();
- transformS1->Update();
- transformS2->Update();
- transformS3->Update();
+ try {
+ transformV->Update();
+ transformS1->Update();
+ transformS2->Update();
+ transformS3->Update();
+ vol->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
+ //vol->Update(propID);
+ surface1->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
+ //surface1->Update(propID);
+ surface2->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
+ //surface2->getRenderer()->Render();
+ surface3->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
+ //surface3->getRenderer()->Render();
+ } catch (...) {
+ throw ;
+ }
- vol->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
- //vol->Update(propID);
-
- surface1->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
- //surface1->Update(propID);
-
- surface2->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
- //surface2->getRenderer()->Render();
-
- surface3->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
- //surface3->getRenderer()->Render();
}
~wxMaracasRenderImageTransformation();
void Translate(int tx, int ty, int tz, int rx, int ry, int rz, int sx, int sy, int sz);
- void Refresh()throw(char*);
+// EED 2022-08-04
+// void Refresh()throw(char*);
+ void Refresh();
private:
VolumeRendererManager* vol;
/**
** Returns internal panel
**/
-wxMaracasRenderTabbedPanel* wxMaracasRendererView::getTabbedPanel(int id) throw(char*)
+// EED 2022-08-04 throw
+//wxMaracasRenderTabbedPanel* wxMaracasRendererView::getTabbedPanel(int id) throw(char*)
+wxMaracasRenderTabbedPanel* wxMaracasRendererView::getTabbedPanel(int id)
{
- int i;
- for(i = 0; i < (int)tabsVector.size(); i++)
- {
- if(tabsVector[i]->getPropIdV() == id)
- return tabsVector[i];
+ try {
+ int i;
+ for(i = 0; i < (int)tabsVector.size(); i++)
+ {
+ if(tabsVector[i]->getPropIdV() == id)
+ return tabsVector[i];
+ }
+ throw "id not found";
+ return NULL;
+ } catch (...) {
+ throw ;
}
- throw "id not found";
-
- return NULL;
}
/**
static wxMaracasRendererView* getInstance();
std::string getPath();
- wxMaracasRenderTabbedPanel* getTabbedPanel(int id) throw(char*);
+
+// EED 2022-08-04
+// wxMaracasRenderTabbedPanel* getTabbedPanel(int id) throw(char*);
+ wxMaracasRenderTabbedPanel* getTabbedPanel(int id);
void setRenderer(vtkRenderer* renderer); /* throw(char*), */ // JPR
void setVtkBaseView(wxVtk3DBaseView* base);
//_iren=NULL;
}
//-------------------------------------------------------------------
-crea::wxVTKRenderWindowInteractor* wxVtkBaseView::GetWxVTKRenderWindowInteractor() throw (char*)
+
+// EED 2022-08-04 throw
+//crea::wxVTKRenderWindowInteractor* wxVtkBaseView::GetWxVTKRenderWindowInteractor() throw (char*)
+crea::wxVTKRenderWindowInteractor* wxVtkBaseView::GetWxVTKRenderWindowInteractor()
{
- if(_iren==NULL)
- {
- throw "wxVtkBaseView::GetWxVTKRenderWindowInteractor() _iren cwxVTKRenderWindowInteractorPlus =NULL";
+ try {
+ if(_iren==NULL)
+ {
+ throw "wxVtkBaseView::GetWxVTKRenderWindowInteractor() _iren cwxVTKRenderWindowInteractorPlus =NULL";
+ }
+ return _iren;
+ } catch (...) {
+ throw ;
}
- return _iren;
+
}
//-------------------------------------------------------------------
void wxVtkBaseView::Configure() // virtual
wxVtkBaseView( );
wxVtkBaseView( wxWindow *parent, bool TDxWindow=false );
virtual ~wxVtkBaseView();
- crea::wxVTKRenderWindowInteractor *GetWxVTKRenderWindowInteractor() throw (char*);
+
+// EED 2022-08-04
+// crea::wxVTKRenderWindowInteractor *GetWxVTKRenderWindowInteractor() throw (char*);
+ crea::wxVTKRenderWindowInteractor *GetWxVTKRenderWindowInteractor();
+
virtual void Configure();
virtual void Refresh();
virtual void RefreshView();
}
//-------------------------------------------------------------------
-wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*)
+// EED 2022-08-04 throw
+//wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*)
+wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()
{
- if(_wxvtk3Dbaseview==NULL){
- throw "wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview() _wxvtk3Dbaseview=NULL";
+ try {
+ if(_wxvtk3Dbaseview==NULL){
+ throw "wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview() _wxvtk3Dbaseview=NULL";
+ }
+ return _wxvtk3Dbaseview;
+ } catch (...) {
+ throw ;
}
- return _wxvtk3Dbaseview;
}
//-------------------------------------------------------------------
void SetVisibleBoxVolume(bool visible);
void SetRepSurfaceWireFrame(int idTissue , bool typeRepresentation );
- wxVtk3DBaseView* GetWxvtk3Dbaseview()throw(char*);
+// EED 2022-08-04
+// wxVtk3DBaseView* GetWxvtk3Dbaseview()throw(char*);
+ wxVtk3DBaseView* GetWxvtk3Dbaseview();
void SetRayCasting(bool active);
void SetMIPActive(bool active);
- void SetInterpolation(bool active);
- void SetShade(bool active);
+ void SetInterpolation(bool active);
+ void SetShade(bool active);
- void UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun);
+ void UpdateVolumeBox(vector<double> gf, vector<double> vf, vtkColorTransferFunction* ctfun);
private:
return _vtkmpr3Ddataviewer;
}
//-------------------------------------------------------------------
-wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() throw (char*)
+// EED 2022-08-04 throw
+//wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() throw (char*)
+wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview()
{
- if(_wxvtk3Dbaseview==NULL)
- {
- throw "wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() _wxvtk3Dbaseview=NULL";
+ try {
+ if(_wxvtk3Dbaseview==NULL)
+ {
+ throw "wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() _wxvtk3Dbaseview=NULL";
+ }
+ return _wxvtk3Dbaseview;
+ } catch (...) {
+ throw ;
}
- return _wxvtk3Dbaseview;
}
//-------------------------------------------------------------------
void SetVtkMPR3DDataViewer( vtkMPR3DDataViewer *vtkmpr3Ddataviewer );
wxPanel* CreateControlPanel(wxWindow *parent, bool align);
vtkMPR3DDataViewer* GetVtkMPR3DDataViewer();
- wxVtk3DBaseView* GetWxvtk3Dbaseview() throw (char*);
+// EED 2020-08-04
+// wxVtk3DBaseView* GetWxvtk3Dbaseview() throw (char*);
+ wxVtk3DBaseView* GetWxvtk3Dbaseview();
void InitOrientationPointWidget();
void showOutlineBoxActor(bool value);
void showOutlinePlaneActor(bool value);
{
return _MPR->GetVtkPlane2DView();
}
+
//----------------------------------------------------------------------------
-wxVtkMPR3DView *wxMaracasMPR::GetWxvtkmpr3Dview_BB() throw(char*)
+// EED 2022-08-04 throw
+//wxVtkMPR3DView *wxMaracasMPR::GetWxvtkmpr3Dview_BB() throw(char*)
+wxVtkMPR3DView *wxMaracasMPR::GetWxvtkmpr3Dview_BB()
{
- if(_MPR == NULL){
- throw "wxVtkMPR3DView *wxMaracasMPR::GetWxvtkmpr3Dview_BB() _MPR =NULL";
- }
- if(_MPR->GetWxvtkmpr3Dview_BB() ==NULL){
- throw "wxVtkMPR3DView *wxMaracasMPR::GetWxvtkmpr3Dview_BB() _MPR->GetWxvtkmpr3Dview_BB()=NULL";
+ try {
+ if(_MPR == NULL){
+ throw "wxVtkMPR3DView *wxMaracasMPR::GetWxvtkmpr3Dview_BB() _MPR =NULL";
+ }
+ if(_MPR->GetWxvtkmpr3Dview_BB() ==NULL){
+ throw "wxVtkMPR3DView *wxMaracasMPR::GetWxvtkmpr3Dview_BB() _MPR->GetWxvtkmpr3Dview_BB()=NULL";
+ }
+ return _MPR->GetWxvtkmpr3Dview_BB();
+ } catch (...) {
+ throw ;
}
- return _MPR->GetWxvtkmpr3Dview_BB();
}
//----------------------------------------------------------------------------
void ConfigureVTK();
vtkMPRBaseData *GetVtkMPRBaseData();
vtkPlane2DView *GetVtkPlane2DView();
- wxVtkMPR3DView *GetWxvtkmpr3Dview_BB()throw(char*);
+
+// EED 2022-08-04 throw
+// wxVtkMPR3DView *GetWxvtkmpr3Dview_BB()throw(char*);
+ wxVtkMPR3DView *GetWxvtkmpr3Dview_BB();
+
void RefreshView();
void setImageData(vtkImageData *img, double voxelsize);
_lstPointsz = lstPointsz;
}
-void PlaneDirectionManager::UpdateDirections() throw (std::exception){
- UpdateVectors();
- UpdateActors();
- AddActors();
-
+// EED 2022-08-04 throw
+//void PlaneDirectionManager::UpdateDirections() throw (std::exception)
+void PlaneDirectionManager::UpdateDirections()
+{
+ try {
+ UpdateVectors();
+ UpdateActors();
+ AddActors();
+ } catch (...) {
+ throw ;
+ }
}
void PlaneDirectionManager::AddActors(){
}
}
-void PlaneDirectionManager::RemoveAllActorsFromIndex(int n)throw (std::exception){
- /*due to incompleate set of points to create the plane
- */
- if(_render==NULL){
- throw std::exception();
+// EED 2022-08-04 throw
+//void PlaneDirectionManager::RemoveAllActorsFromIndex(int n)throw (std::exception)
+void PlaneDirectionManager::RemoveAllActorsFromIndex(int n)
+{
+ try{
+ /*due to incompleate set of points to create the plane
+ */
+ if(_render==NULL){
+ throw std::exception();
+ }
+ for(int i = _vectdata.size()-1; i >= n;i--){
+ _render->RemoveViewProp(_vectdata[i]->GetActor());
+ delete _vectdata[i];
+ _vectdata.pop_back();
+ }
+ } catch (...) {
+ throw ;
}
- for(int i = _vectdata.size()-1; i >= n;i--){
- _render->RemoveViewProp(_vectdata[i]->GetActor());
- delete _vectdata[i];
- _vectdata.pop_back();
- }
}
-void PlaneDirectionManager::UpdateVectors()throw (std::exception){
- PlaneDirectionManagerData* temp;
- bool deletelast = false;
- int currentdata = 0;
- int i;
- for(i = 0; i < (int)_lstPointsx.size();i++){
- if(i % 3 == 0){
- if((int)_vectdata.size()>currentdata){
- temp = _vectdata[currentdata];
- }else{
- temp = new PlaneDirectionManagerData(_radio, _colour, _opacity);
- _vectdata.push_back(temp);
+
+// EED 2022-08-04 throw
+//void PlaneDirectionManager::UpdateVectors()throw (std::exception)
+void PlaneDirectionManager::UpdateVectors()
+{
+ try{
+ PlaneDirectionManagerData* temp;
+ bool deletelast = false;
+ int currentdata = 0;
+ int i;
+ for(i = 0; i < (int)_lstPointsx.size();i++){
+ if(i % 3 == 0){
+ if((int)_vectdata.size()>currentdata){
+ temp = _vectdata[currentdata];
+ }else{
+ temp = new PlaneDirectionManagerData(_radio, _colour, _opacity);
+ _vectdata.push_back(temp);
+ }
+ temp->setPoint0(_lstPointsx[i],_lstPointsy[i],_lstPointsz[i]);
+ deletelast = true;
+ }else if(i % 3 == 1){
+ temp->setPoint1(_lstPointsx[i],_lstPointsy[i],_lstPointsz[i]);
+ }else if(i % 3 == 2){
+ temp->setPoint2(_lstPointsx[i],_lstPointsy[i],_lstPointsz[i]);
+ currentdata++;
+ deletelast = false;
}
- temp->setPoint0(_lstPointsx[i],_lstPointsy[i],_lstPointsz[i]);
- deletelast = true;
- }else if(i % 3 == 1){
- temp->setPoint1(_lstPointsx[i],_lstPointsy[i],_lstPointsz[i]);
- }else if(i % 3 == 2){
- temp->setPoint2(_lstPointsx[i],_lstPointsy[i],_lstPointsz[i]);
- currentdata++;
- deletelast = false;
}
+ RemoveAllActorsFromIndex(currentdata);
+ } catch (...) {
+ throw ;
}
- RemoveAllActorsFromIndex(currentdata);
}
void PlaneDirectionManager::UpdateActors()
#define PlaneDirectionManager_H_
#include <math.h>
-
#include <iostream>
-
#include "PlaneDirectionManagerData.h"
-
#include <vector>
-
#include <vtkRenderer.h>
-class PlaneDirectionManager {
-
+class PlaneDirectionManager
+{
public:
PlaneDirectionManager(int radio, double colour[3], int opacity);
- ~PlaneDirectionManager();
-
+ ~PlaneDirectionManager();
void SetRenderer(vtkRenderer* render);
void SetVectors( std::vector<double> lstPointsx, std::vector<double> lstPointsy, std::vector<double> lstPointsz);
-
- void UpdateDirections() throw (std::exception);
-
- std::vector<PlaneDirectionManagerData*> GetPlanesData(){
+// EED 2022-08-04 throw
+// void UpdateDirections() throw (std::exception);
+ void UpdateDirections();
+ std::vector<PlaneDirectionManagerData*> GetPlanesData()
+ {
return _vectdata;
}
-
void addRemoveActor(int index, bool addremove);
-
void changeColor(int index,double r,double g,double b);
-
PlaneDirectionManagerData* GetPlaneDirectionManagerData(int id);
-
void WriteInformation(std::string filename, double* spc=NULL);
-
void SetArrowSize(int arrowsize);
private:
-
std::vector<double> _lstPointsx;
std::vector<double> _lstPointsy;
std::vector<double> _lstPointsz;
-
std::vector<PlaneDirectionManagerData*> _vectdata;
-
- void RemoveAllActorsFromIndex(int n=0)throw (std::exception);
- void UpdateVectors()throw (std::exception);
-
+// EED 2022-08-04 throw
+// void RemoveAllActorsFromIndex(int n=0)throw (std::exception);
+ void RemoveAllActorsFromIndex(int n=0);
+// EED 2022-08-04 throw
+// void UpdateVectors()throw (std::exception);
+ void UpdateVectors();
void UpdateActors();
void AddActors();
-
- vtkRenderer* _render;
-
- int _radio;
- double* _colour;
- int _opacity;
-
+ vtkRenderer *_render;
+ int _radio;
+ double *_colour;
+ int _opacity;
};
#endif /*PlaneDirectionManager_H_*/