Program: wxMaracas
Module: $RCSfile: CutModel2Manager.cxx,v $
Language: C++
- Date: $Date: 2009/11/23 13:00:30 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2009/12/08 13:42:39 $
+ Version: $Revision: 1.4 $
Copyright: (c) 2002, 2003
License:
CutModel2Manager::CutModel2Manager(std::string path){
_path = path;
_img = NULL;
- _copyimg = NULL;
+ _img2 = NULL;
_interactor = NULL;
_render = NULL;
_currentaction=0;
std::string files = _path;
files+="/infounrd_0_fig_0.info";
remove(files.c_str());
+ _vectordata.clear();
+ _img = NULL;
+ _img2 = NULL;
+ _interactor = NULL;
+ _render = NULL;
}
void CutModel2Manager::setImageData(vtkImageData* img){
_img = img;
- if(_copyimg!=NULL){
- _copyimg->Delete();
+ if(_img2!=NULL){
+ _img2->Delete();
}
- _copyimg = vtkImageData::New();
- _copyimg->SetExtent(_img->GetExtent());
- _copyimg->SetSpacing(_img->GetSpacing());
- _copyimg->AllocateScalars();
+ _img2 = vtkImageData::New();
+ _img2->SetExtent(_img->GetExtent());
+ _img2->SetSpacing(_img->GetSpacing());
+ _img2->AllocateScalars();
- _copyimg->DeepCopy(_img);
+ _img2->DeepCopy(_img);
}
void CutModel2Manager::onAddCutModel2(int id, vtkCommand* observer) throw( CutModelException){
checkInvariant();
-
- CutModelData* data = new CutModelData(id,_interactor, observer, _copyimg);
+ CutModelData* data = new CutModelData(id,_interactor, observer, _img2);
_vectordata.push_back(data);
_render->AddActor(data->getActor());
if(_img==NULL){
throw CutModelException("The image is not set");
}
- if(_copyimg==NULL){
+ if(_img2==NULL){
throw CutModelException("The copyimage is not set");
}
if(_interactor==NULL){
double* CutModel2Manager::getImageRange()throw( CutModelException){
checkInvariant();
- return _copyimg->GetScalarRange();
+ return _img2->GetScalarRange();
}
void CutModel2Manager::changeOpacity(int id,int opacity)throw( CutModelException){
vtkImageData* CutModel2Manager::GetResultImage(){
checkInvariant();
- return _copyimg;
+ return _img2;
}
void CutModel2Manager::RefreshActor(int id){
currentmodel->setCurrentShape(currentundo->getCurrentShape());
- currentmodel->ExecuteUnCut(currentundo->getIsInside(), _copyimg, _img);
+ currentmodel->ExecuteUnCut(currentundo->getIsInside(), _img2, _img);
}
//Every thing ok
//Redo the cut
vtkTransform* transform = currentundo->getTransformFromMatrixFile();
currentmodel = getCutModelData(currentundo->getId());
- currentmodel->setTransform(transform, _copyimg);
+ currentmodel->setTransform(transform, _img2);
currentmodel->setCurrentShape(currentundo->getCurrentShape());
- currentmodel->ExecuteCut(currentundo->getRange(), currentundo->getIsInside(), _copyimg);
+ currentmodel->ExecuteCut(currentundo->getRange(), currentundo->getIsInside(), _img2);
}
_currentaction++;