+++ /dev/null
-#include "bbcreaMaracasVisuCutModule2.h"
-#include "bbcreaMaracasVisuPackage.h"
-#include "creaSystem.h"
-
-namespace bbcreaMaracasVisu
-{
-
-BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,CutModule2)
-BBTK_BLACK_BOX_IMPLEMENTATION(CutModule2,bbtk::WxBlackBox);
-void CutModule2::Process()
-{
-
- vtkImageData* img = bbGetInputIn();
- vtkRenderWindowInteractor* interactor = bbGetInputInteractor();
- vtkRenderer* render = bbGetInputRenderer();
-
- if(img != NULL && interactor != NULL && render != NULL && _mainpanel!=NULL){
-
- if(_currentimage!=img){
- _currentimage=img;
- _mainpanel->setImageData(img);
- }
-
- _mainpanel->setInteractor(interactor);
- _mainpanel->setRenderer(render);
- //bbSetOutputOut(_mainpanel->GetResultImage());
-
- }
-
-}
-void CutModule2::CreateWidget(wxWindow* parent)
-{
-
- std::string path = crea::System::GetDllAppPath("bbcreaMaracasVisu.dll");
- _mainpanel = CutModel2MainPanel::getInstance(parent, path);
-
- bbSetOutputWidget( _mainpanel);
- Process();
-
-}
-void CutModule2::bbUserSetDefaultValues()
-{
- _mainpanel = NULL;
- _currentimage=NULL;
-}
-void CutModule2::bbUserInitializeProcessing()
-{
- bbSetInputIn(0);
- bbSetInputInteractor(0);
- bbSetInputRenderer(0);
-}
-void CutModule2::bbUserFinalizeProcessing()
-{
-
-}
-}
-// EO namespace bbcreaMaracasVisu
-
-
+++ /dev/null
-#ifdef _USE_WXWIDGETS_
-#ifndef __bbcreaMaracasVisuCutModule2_h_INCLUDED__
-#define __bbcreaMaracasVisuCutModule2_h_INCLUDED__
-#include "bbcreaMaracasVisu_EXPORT.h"
-#include "bbtkWxBlackBox.h"
-#include "CutModel2MainPanel.h"
-
-namespace bbcreaMaracasVisu
-{
-
-class bbcreaMaracasVisu_EXPORT CutModule2
- :
- public bbtk::WxBlackBox
-{
-
- BBTK_BLACK_BOX_INTERFACE(CutModule2,bbtk::WxBlackBox);
- BBTK_DECLARE_INPUT(In,vtkImageData*);
- BBTK_DECLARE_INPUT(Interactor,vtkRenderWindowInteractor*);
- BBTK_DECLARE_INPUT(Renderer,vtkRenderer*);
- //BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
- BBTK_PROCESS(Process);
- void Process();
- BBTK_CREATE_WIDGET(CreateWidget);
- void CreateWidget(wxWindow*);
-
-private:
- CutModel2MainPanel* _mainpanel;
- vtkImageData* _currentimage;
-};
-
-BBTK_BEGIN_DESCRIBE_BLACK_BOX(CutModule2,bbtk::WxBlackBox);
-BBTK_NAME("CutModule2");
-BBTK_AUTHOR("perez@creatis.insa-lyon.fr");
-BBTK_DESCRIPTION("extracts");
-BBTK_CATEGORY("__CategoryBlackBox__");
-BBTK_INPUT(CutModule2,In,"Image",vtkImageData*,"");
-BBTK_INPUT(CutModule2,Interactor,"WindowInteractor",vtkRenderWindowInteractor*,"");
-BBTK_INPUT(CutModule2,Renderer,"Renderer",vtkRenderer*,"");
-//BBTK_OUTPUT(CutModule2,Out,"Image output",vtkImageData*,"");
-BBTK_END_DESCRIBE_BLACK_BOX(CutModel2);
-}
-// EO namespace bbcreaMaracasVisu
-
-#endif // __bbcreaMaracasVisuCutModule2_h_INCLUDED__
-#endif // _USE_WXWIDGETS_
-
if(_img4 !=NULL){
volview->addVolume(_img4, "INPUT 4");
}
- }
+ }
+
+ vtkImageData* img1 = volview->GetOutputImages()[0];
+
+ bbSetOutputOut0(img1);
+ bbSetOutputOut1(volview->GetOutputImages()[1]);
+ bbSetOutputOut2(volview->GetOutputImages()[2]);
+ bbSetOutputOut3(volview->GetOutputImages()[3]);
}
- bbSetOutputOut0(volview->GetOutputImages()[0]);
- bbSetOutputOut1(volview->GetOutputImages()[1]);
- bbSetOutputOut2(volview->GetOutputImages()[2]);
- bbSetOutputOut3(volview->GetOutputImages()[3]);
+
}
_tfun->RemoveAllPoints();
for(int i = 0; i < greylevel.size();i++){
_tfun->AddPoint(greylevel[i], value[i]);
- //std::cout<<"TransferFunctionView::Process()transfer function "<<greylevel[i]<<" "<< value[i]<<std::endl;
+ std::cout<<"TransferFunctionView::Process()transfer function "<<greylevel[i]<<" "<< value[i]<<std::endl;
}
_ctfun->RemoveAllPoints();
for(int i = 0; i < greylevelcolors.size();i++){
_ctfun->AddRGBPoint(greylevelcolors[i], red[i],green[i], blue[i]);
- //std::cout<<"TransferFunctionView::Process()transfer color function "<<greylevelcolors[i]<<" "<<red[i]<<" "<<green[i]<<" "<<blue[i]<<std::endl;
+ std::cout<<"TransferFunctionView::Process()transfer color function "<<greylevelcolors[i]<<" "<<red[i]<<" "<<green[i]<<" "<<blue[i]<<std::endl;
}
bbSignalOutputModification();
void TransferFunctionView::bbUserInitializeProcessing()
{
_tfun = vtkPiecewiseFunction::New();
- _ctfun = vtkColorTransferFunction::New();
+ _ctfun = vtkColorTransferFunction::New();
+ _ctfun->SetClamping(-1);
bbSetInputIn(NULL);
}
mwxwidget->setWindowLevel(bbGetInputWindowLevel());
}
if(bbGetInputColorLevel()!=-1){
- mwxwidget->setColorLevel(bbGetInputColorLevel());
+ if(bbGetInputColorLevel() == 0){
+ std::cout<<"colorlevel "<<bbGetInputColorLevel()<<std::endl;
+ mwxwidget->setColorLevel(0.1);
+ }else{
+ mwxwidget->setColorLevel(bbGetInputColorLevel());
+ }
}
}
}
SET(CPACK_NSIS_HELP_LINK "http://www.creatis.insa-lyon.fr/creatools/${PROJECT_NAME}")
SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.creatis.insa-lyon.fr/creatools/${PROJECT_NAME}")
SET(CPACK_NSIS_CONTACT "info-dev@creatis.insa-lyon.fr")
- SET(CPACK_NSIS_MODIFY_PATH ON)
+ #SET(CPACK_NSIS_MODIFY_PATH ON)
ELSE(WIN32 AND NOT UNIX)
# SET(CPACK_STRIP_FILES "bin/bbi")
SET(CPACK_SOURCE_STRIP_FILES "")
+++ /dev/null
-/*=========================================================================
-
- Program: wxMaracas
- Module: $RCSfile: CutModelManager2.cxx,v $
- Language: C++
- Date: $Date: 2009/11/19 15:01:30 $
- Version: $Revision: 1.1 $
-
- Copyright: (c) 2002, 2003
- License:
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-#include "CutModelManager.h"
-
-/**
-** Start of the manager class
-**/
-CutModelManager::CutModelManager(std::string path){
- _path = path;
- _img = NULL;
- _copyimg = NULL;
- _interactor = NULL;
- _render = NULL;
- _currentaction=0;
-}
-CutModelManager::~CutModelManager(){
- std::string files = _path;
- files+="/infounrd_0_fig_0.info";
- remove(files.c_str());
-}
-
-
-void CutModelManager::setImageData(vtkImageData* img){
- _img = img;
- if(_copyimg!=NULL){
- _copyimg->Delete();
- }
- _copyimg = vtkImageData::New();
- _copyimg->SetExtent(_img->GetExtent());
- _copyimg->SetSpacing(_img->GetSpacing());
- _copyimg->AllocateScalars();
-
- _copyimg->DeepCopy(_img);
-
-}
-
-void CutModelManager::setInteractor(vtkRenderWindowInteractor* interactor){
- _interactor = interactor;
-}
-
-void CutModelManager::setRenderer(vtkRenderer* renderer){
- _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();
-}
-
-void CutModelManager::checkInvariant() throw( CutModelException){
- if(_img==NULL){
- throw CutModelException("The image is not set");
- }
- if(_copyimg==NULL){
- throw CutModelException("The image is not set");
- }
- if(_interactor==NULL){
- throw CutModelException("Interactor not set");
- }
- if(_render==NULL){
- throw CutModelException("Render not set");
- }
-}
-
-double* CutModelManager::getImageRange()throw( CutModelException){
- checkInvariant();
- return _img->GetScalarRange();
-}
-
-void CutModelManager::changeOpacity(int id,int opacity)throw( CutModelException){
- checkInvariant();
- CutModelData* current = getCutModelData(id);
- current->changeOpacity(opacity);
-}
-
-void CutModelManager::ShowViewBox(int id,bool check)throw( CutModelException){
- checkInvariant();
- CutModelData* current = getCutModelData(id);
- current->ShowViewBox(check);
-}
-
-void CutModelManager::ChangeShape(int id,int selection)throw( CutModelException){
- checkInvariant();
- CutModelData* current = getCutModelData(id);
- current->ChangeShape(selection);
- _render->Render();
-}
-
-CutModelData* CutModelManager::getCutModelData(int id)throw( CutModelException){
-
- CutModelData* current = NULL;
- for(int i= 0; i < _vectordata.size();i++){
- std::cout<<"id in CutModelManager:: "<<id<<std::endl;
- std::cout<<"vectordataid in CutModelManager:: "<<_vectordata[i]->getId()<<std::endl;
-
- if(_vectordata[i]->getId()==id){
- current = _vectordata[i];
- }
- }
- if(current ==NULL){
-
- throw CutModelException("Data not found");
- }
- return current;
-}
-
-void CutModelManager::updateActorDirection(int id)throw( CutModelException){
- checkInvariant();
- CutModelData* current = getCutModelData(id);
- current->udapteActorDirection();
-
-}
-
-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();
-}
-void CutModelManager::RemoveActor(int id)throw( CutModelException){
-
- checkInvariant();
-
- CutModelData* current = getCutModelData(id);
- for(int i = 0; i < _vectordata.size()-1;i++){
- if(_vectordata[i]->getId()==id){
- for(int j = i; j < _vectordata.size()-1;j++){
- _vectordata[j]=_vectordata[j+1];
- }
- i = _vectordata.size();
- }
- }
- _render->RemoveActor(current->getActor());
- 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, _img);
-
-
- /*
- Setting extra information for the undo
- */
- CutModelSaveBinInfo* undoaction = this->AddActionUndo(id, CUTMODEL_CUT);
- undoaction->setRange(range);
- undoaction->setIsInside(isinside);
-
-}
-
-vtkImageData* CutModelManager::GetResultImage(){
- checkInvariant();
- return _copyimg;
-}
-
-void CutModelManager::RefreshActor(int id){
- checkInvariant();
- CutModelData* current = getCutModelData(id);
- _render->RemoveActor(current->getActor());
- _render->AddActor(current->getActor());
- current->RefreshViewBox();
- _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");
-
-}
-
-CutModelSaveBinInfo* CutModelManager::AddActionUndo(int idc, UNDOTYPE type)throw( CutModelException){
-
- 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;
-}
-
-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, _copyimg);
-
- currentmodel->setCurrentShape(currentundo->getCurrentShape());
-
- currentmodel->ExecuteUnCut(currentundo->getIsInside(), _img, _copyimg);
-
- }
- //Every thing ok
- _currentaction--;
- return 0;
- }
- return -1;
-}
-
-int CutModelManager::Redo() throw( CutModelException){
-
- if(_currentaction >= 0 && _currentaction < _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, _copyimg);
- currentmodel->setCurrentShape(currentundo->getCurrentShape());
- currentmodel->ExecuteCut(currentundo->getRange(), currentundo->getIsInside(), _copyimg);
- }
-
- _currentaction++;
-
- return 0;
- }
- return -1;
-}
\ No newline at end of file
Program: wxMaracas
Module: $RCSfile: wxMaracasMultipleVolumeRendererManager.cxx,v $
Language: C++
- Date: $Date: 2009/11/18 13:13:25 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2009/11/20 17:09:05 $
+ Version: $Revision: 1.9 $
Copyright: (c) 2002, 2003
License:
return getViewData(volumeid)->GetColorFunction();
}
+
+void wxMaracasMultipleVolumeRendererManager::changeCompositeMIPFunction(int id, int function) throw (char *){
+ getViewData(id)->changeCompositeMIPFunction(function);
+}
\ No newline at end of file
Program: wxMaracas
Module: $RCSfile: wxMaracasMultipleVolumeRendererManager.h,v $
Language: C++
- Date: $Date: 2009/11/17 10:22:59 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2009/11/20 17:09:05 $
+ Version: $Revision: 1.7 $
Copyright: (c) 2002, 2003
License:
** Given an id search the data in the vector
**/
wxMaracasMultipleVolumeRendererManagerData* getViewData(int id)throw(char*);
+
+ void changeCompositeMIPFunction(int id, int function) throw (char *);
/**
** Deletes given actor
_volumePlanes = vtkPlanes::New();
_compositeFunction = vtkVolumeRayCastCompositeFunction::New();
+ _MIPFunction = vtkVolumeRayCastMIPFunction::New();
+
_volumeMapper = vtkVolumeRayCastMapper::New();
_volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
_volumeMapper->SetClippingPlanes( _volumePlanes );
/**
** Check if the variables are setted correctly
**/
-void wxMaracasMultipleVolumeRendererManagerData::checkInvariant(){
-
+void wxMaracasMultipleVolumeRendererManagerData::checkInvariant()throw (char *){
+ if(!_compositeFunction){
+ throw "No composite function initialized";
+ }
+ if(!_MIPFunction){
+ throw "No MIP function initialized";
+ }
+ if(!_volumeMapper){
+ throw "No volume mapper initialized";
+ }
}
/**
_dataname = dataname;
}
+void wxMaracasMultipleVolumeRendererManagerData::changeCompositeMIPFunction(int function) throw (char *){
+ checkInvariant();
+ if(function == 0){
+ _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
+ }else{
+ _volumeMapper->SetVolumeRayCastFunction(_MIPFunction);
+ }
+
+}
#include <vtkImageData.h>
#include <vtkProp3D.h>
#include <vtkRenderer.h>
+#include <vtkVolumeRayCastMIPFunction.h>
#include <vector>
/**
** Check if the variables are setted correctly
**/
- void checkInvariant();
+ void checkInvariant()throw (char *);
/**
** Updates volume
vtkColorTransferFunction* GetColorFunction(){
return _ctfun;
}
+
+ void changeCompositeMIPFunction(int function) throw (char *);
protected:
/**
vtkVolume *_newvol;
vtkPiecewiseFunction* _tfun;
vtkColorTransferFunction* _ctfun;
+ vtkVolumeRayCastMIPFunction* _MIPFunction;
};
{
wxStaticText* label = new wxStaticText(this, -1, wxString(_T("")));
wxStaticText* label2 = new wxStaticText(this, -1, wxString(_T("")));
+
+
checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor")));
Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onCheckBoxChange);
checkbox->SetValue(true);
+ wxString choices[] = {_T("Composite"), _T("MIP")};
+ _radiobox = new wxRadioBox(this, -1, wxString(_T("Function")), wxDefaultPosition, wxDefaultSize, 2, choices);
+ Connect(_radiobox->GetId(), wxEVT_COMMAND_RADIOBOX_SELECTED, (wxObjectEventFunction)&wxMaracasMultipleVolumeRendererPanel::onRadioBoxSelectFunction);
+
sizerirmprop->Add(checkbox,wxFIXED_MINSIZE);
- sizerirmprop->Add(label,wxFIXED_MINSIZE);
- sizerirmprop->Add(label2,wxFIXED_MINSIZE);
+ sizerirmprop->AddSpacer(5);
+ sizerirmprop->Add(_radiobox,wxFIXED_MINSIZE);
+ //sizerirmprop->Add(label2,wxFIXED_MINSIZE);
}
//wxBitmap bitmap(Color_xpm);
//_colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30));
return _propid;
}
+void wxMaracasMultipleVolumeRendererPanel::onRadioBoxSelectFunction(wxCommandEvent& event){
+
+ wxMaracasMultipleVolumeRendererView::getInstance()->changeCompositeMIPFunction(this->getPropId(), _radiobox->GetSelection());
+}
+
/**
** Carolina Perez: Recently added method
**/
HistogramDialogComboBox* wxMaracasMultipleVolumeRendererPanel::getMwxwidget()
{
return mwxwidget;
-}
\ No newline at end of file
+}
+
void onCancel(wxCommandEvent& event);
void onUpdate(wxCommandEvent& event);
void onViewImage(wxCommandEvent& event);
+ void onRadioBoxSelectFunction(wxCommandEvent& event);
void updateVolume();
int getPropId();
private:
wxCheckBox* checkbox;
+ wxRadioBox* _radiobox;
wxBitmapButton* _viewimage;
int _propid;
Program: wxMaracas
Module: $RCSfile: wxMaracasMultipleVolumeRendererView.cxx,v $
Language: C++
- Date: $Date: 2009/11/19 15:01:18 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2009/11/20 17:09:05 $
+ Version: $Revision: 1.9 $
Copyright: (c) 2002, 2003
License:
return instance;
}
+void wxMaracasMultipleVolumeRendererView::changeCompositeMIPFunction(int id, int function){
+ try{
+ volmanager->changeCompositeMIPFunction(id, function);
+ }
+ catch(char* str){
+ std::cout << "Exception : " << str << '\n';
+ wxMessageDialog* diag = new wxMessageDialog(this, wxString( str,wxConvUTF8 ), wxString( str,wxConvUTF8 ), wxICON_ERROR);
+ diag->ShowModal();
+ }
+}
+
void wxMaracasMultipleVolumeRendererView::setRenderer(vtkRenderer* renderer){
volmanager->setRenderer(renderer);
}
Program: wxMaracas
Module: $RCSfile: wxMaracasMultipleVolumeRendererView.h,v $
Language: C++
- Date: $Date: 2009/11/19 15:01:18 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2009/11/20 17:09:05 $
+ Version: $Revision: 1.5 $
Copyright: (c) 2002, 2003
License:
std::vector<vtkImageData*> GetOutputImages();
+ void changeCompositeMIPFunction(int id, int function);
+
private:
static wxMaracasMultipleVolumeRendererView* instance;