load std
-load vtk
+include vtk
load wx
load creaMaracasVisu
void CutModule2::CreateWidget(wxWindow* parent)
{
std::string lastname("bbcreaMaracasVisu.dll"); // JPR
- std::string path = crea::System::GetDllAppPath(lastname);
+ std::string path = crea::System::GetDllAppPath(lastname);
+
_mainpanel = CutModelMainPanel::getInstance(parent, path);
_mainpanel->SetType(1);
spc[2]=1;
}
- for(int i = 0; i < lstPointsx.size();i++){
+ int i;
+ for(i = 0; i < (int)lstPointsx.size();i++){
_lstPointsx.push_back(lstPointsx[i]*spc[0]);
_lstPointsy.push_back(lstPointsy[i]*spc[1]);
_lstPointsz.push_back(lstPointsz[i]*spc[2]);
tempvect.push_back(bbGetInputIn3());
tempvect.push_back(bbGetInputIn4());
- for(i = 0; i < tempvect.size();i++){
+ for(i = 0; i < (int)tempvect.size();i++){
prop3D = tempvect[i];
if(prop3D != NULL&&renderer != NULL){
surrend->addPropMHD(prop3D);
// color
double r,g,b;
- if ( (iAxis*3+1) < (int)(bbGetInputColour().size()) ){
+ if ( (iAxis*3+1) < (int)(bbGetInputColour().size()) )
+ {
r = bbGetInputColour()[0+iAxis*3];
g = bbGetInputColour()[1+iAxis*3];
b = bbGetInputColour()[2+iAxis*3];
- } else {
- r = bbGetInputColour()[0];
- g = bbGetInputColour()[1];
- b = bbGetInputColour()[2];
- }
+ } else {
+// r = bbGetInputColour()[0];
+// g = bbGetInputColour()[1];
+// b = bbGetInputColour()[2];
+ r = (rand() % 100) / 100.0;
+ g = (rand() % 100) / 100.0;
+ b = (rand() % 100) / 100.0;
+ }
- vtkactor->GetProperty()->SetColor( 1,0,0 );
- vtkactor->GetProperty()->SetLineWidth( 3 );
+ vtkactor->GetProperty()->SetColor( r,g,b );
+ vtkactor->GetProperty()->SetLineWidth( 0.5 );
if ( bbGetInputTransform()!=NULL )
{
wxSizer *sizer = NULL;
// Widget interface
- askPointLabel = new wxStaticText(panel, -1, _T("Point label :")); // JPR
- textCtrl = new wxTextCtrl(panel, -1);
+ askPointLabel = new wxStaticText(panel, -1, _T("Point label :")); // JPR
+ textCtrl = new wxTextCtrl(panel, -1);
wxButton *btnAddPoint = new wxButton( panel, -1, _T("Add Point"));
wxButton *btnRenamePoint = new wxButton( panel, -1, _T("Rename point"));
wxButton *btnEraseLastPoint = new wxButton( panel, -1, _T("Erase Last point"));
wxButton *btnErasePoint = new wxButton( panel, -1, _T("Erase point"));
- wxButton *btnDeleteAllPoints = new wxButton( panel, -1, _T("Delete all points"));
+ wxButton *btnDeleteAllPoints= new wxButton( panel, -1, _T("Delete all points"));
wxButton *btnSavePoints = new wxButton( panel, -1, _T("Save points"));
wxButton *btnLoadPoints = new wxButton( panel, -1, _T("Load points"));
- txtNrPoints = new wxStaticText(panel,-1, _T(" "));
+ txtNrPoints = new wxStaticText(panel,-1, _T(" "));
//NTU: Sliders for opacity and radio change
y=lstPointsY[i];
z=lstPointsZ[i];
value= mimage->GetScalarComponentAsDouble(x,y,z,0);
- fprintf(ff,"%d\t %d\t %d\t %f\t %s\n", x , y , z , value , lstLabels[i].c_str());
+ fprintf(ff,"%d\t%d\t%d\t%f\t%s\n", x , y , z , value , lstLabels[i].c_str());
} // for
fclose(ff);
} else { // else ff
int x,y,z;
for (i=0; i<size; i++)
{
- fscanf(ff," %d %d %d %f %s",&x,&y,&z,&value,chartmp ); // x,y,z,value,label
+ fscanf(ff,"%d%d%d%f%s",&x,&y,&z,&value,chartmp ); // x,y,z,value,label
AddPoint(x,y,z, chartmp );
}
fclose(ff);
Program: wxMaracas
Module: $RCSfile: CutModelMainPanel.cxx,v $
Language: C++
-Date: $Date: 2010/04/29 16:05:33 $
-Version: $Revision: 1.10 $
+Date: $Date: 2010/09/29 21:21:03 $
+Version: $Revision: 1.11 $
Copyright: (c) 2002, 2003
License:
checkInvariant();
if(!this->IsBeingDeleted()){
- for(int i = 0; i < viewpanels.size()-1;i++){
+ int i,j;
+ for(i = 0; i < (int)viewpanels.size()-1;i++){
CutModelView* view = viewpanels[i];
if(view->getId()==id){
- for(int j = i; j < viewpanels.size()-1;j++){
+ for(j = i; j < (int)viewpanels.size()-1;j++){
viewpanels[j]=viewpanels[j+1];
}
i = viewpanels.size();
Program: wxMaracas
Module: $RCSfile: CutModelData.cxx,v $
Language: C++
- Date: $Date: 2010/03/31 12:41:58 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2010/09/29 21:21:05 $
+ Version: $Revision: 1.7 $
Copyright: (c) 2002, 2003
License:
void CutModelData::setTransform(vtkTransform* transform, vtkImageData* img)throw( CutModelException){
- double *spc = img->GetSpacing(); // spc unused // JPR
+// double *spc = img->GetSpacing(); // spc unused // JPR
currentmatrix->Identity();
public:
CutModelFigure(){}
- //~CutModelFigure();
+ virtual ~CutModelFigure(){}
virtual void SetPosition(double x,double y, double z){
_px = x;
Program: wxMaracas
Module: $RCSfile: CutModelManager.cxx,v $
Language: C++
-Date: $Date: 2010/04/02 07:22:25 $
-Version: $Revision: 1.9 $
+Date: $Date: 2010/09/29 21:21:05 $
+Version: $Revision: 1.10 $
Copyright: (c) 2002, 2003
License:
CutModelData* CutModelManager::getCutModelData(int id)throw( CutModelException){
CutModelData* current = NULL;
- for(int i= 0; i < _vectordata.size();i++){
+ 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;
checkInvariant();
CutModelData* current = getCutModelData(id);
- for(int i = 0; i < _vectordata.size()-1;i++){
+ int i,j;
+ for(i = 0; i < (int)_vectordata.size()-1;i++)
+ {
if(_vectordata[i]->getId()==id){
- for(int j = i; j < _vectordata.size()-1;j++){
+ for(j = i; j < (int)_vectordata.size()-1;j++){
_vectordata[j]=_vectordata[j+1];
}
i = _vectordata.size();
int CutModelManager::Redo() throw( CutModelException){
- if(_currentaction >= 0 && _currentaction < _undoredo.size()){
+ if(_currentaction >= 0 && _currentaction < (int)_undoredo.size()){
CutModelSaveBinInfo* currentundo = _undoredo[_currentaction];
CutModelData* currentmodel;
void PlaneDirectionViewer::UpdateDirections() throw (std::exception){
manager->UpdateDirections();
std::vector<PlaneDirectionManagerData*> vectdata = manager->GetPlanesData();
- for(int i = 0; i < viewdata.size();i++){
+ int i;
+ for(i = 0; i < (int)viewdata.size();i++){
this->GetSizer()->Remove(i);
viewdata[i]->Destroy();
}
viewdata.clear();
- for(int i = 0; i < vectdata.size(); i++){
+ for(i = 0; i < (int)vectdata.size(); i++){
PlaneDirectionViewerPanel* planedirview = new PlaneDirectionViewerPanel(this, vectdata[i],i);
viewdata.push_back(planedirview);
this->GetSizer()->Add(planedirview,1);
#include "OpenImageDialog.h"
+wxDlgTransformByDimensionBySpacingByPixel::wxDlgTransformByDimensionBySpacingByPixel()
+{
+}
+
+wxDlgTransformByDimensionBySpacingByPixel::~wxDlgTransformByDimensionBySpacingByPixel()
+{
+}
+
+
+void wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(wxWindow *parent , wxString message,int &typeOfTransformation,bool &dlgWxOK)
+{
+ wxDialog* dial = new wxDialog (parent,-1,_T("Tools"),wxDefaultPosition, wxSize(590,190));
+ wxSizer* buttonsSizer = dial->CreateSeparatedButtonSizer(wxOK|wxCANCEL);
+ wxBoxSizer *dialSizer = new wxBoxSizer(wxVERTICAL);
+
+ wxString lstOptOperation[3];
+ lstOptOperation[0]=_T("By Dimension");
+ lstOptOperation[1]=_T("By Spacing");
+ lstOptOperation[2]=_T("By Pixel");
+ wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(270,45), 3 , lstOptOperation, 3, wxRA_SPECIFY_COLS);
+
+ dialSizer->Add( new wxStaticText(dial,-1,message) , 0, wxGROW );
+ // dialSizer->Add( new wxStaticText(dial,-1,_T("selected Roi file. Do you want to tranform it?")) , 0, wxGROW );
+ dialSizer->Add( new wxStaticText(dial,-1,_T(" ")) , 0, wxGROW );
+ dialSizer->Add(radioOpts,0,wxGROW);
+ dialSizer->Add( new wxStaticText(dial,-1,_T(" ")) , 0, wxGROW );
+ dialSizer->Add(buttonsSizer,0,wxGROW);
+ dial->SetSizer(dialSizer, true);
+ dial->Layout();
+ dial->ShowModal();
+
+ typeOfTransformation = -1;
+ dlgWxOK = false;
+
+ if (dial->GetReturnCode() == wxID_OK)
+ {
+ typeOfTransformation = radioOpts->GetSelection();
+ dlgWxOK = true;
+ }
+}
+
+//---------------------------------------------------------
+
+
+
/**
** Begin of the threshold panel
**/
ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, int max, int type)
: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
{
- _colorLayerImageView = new ColorLayerImageView();
-
- _btn_ReadImage = new wxButton(this, wxID_ANY, _T("Read Image") );
-
+ _spcBase[0] = _spcBase[1] = _spcBase[2] = 0;
+ _dimBase[0] = _dimBase[1] = _dimBase[2] = 0;
- _thresholdGo = true;
- _cb_ShowHide = new wxCheckBox(this, wxID_ANY, _T("Show/Hide layer") );
+ _colorLayerImageView = new ColorLayerImageView();
+ _btn_ReadImage = new wxButton(this, wxID_ANY, _T("Read Image") );
+ _thresholdGo = true;
+ _cb_ShowHide = new wxCheckBox(this, wxID_ANY, _T("Show/Hide layer") );
_cb_ShowHide->SetValue(_thresholdGo);
_cb_SliceFixDinamic = new wxCheckBox(this, wxID_ANY, _T("Slice Fix/Dinamic") );
_colorLayerImageView = colorLayerImageView;
}
+// This is the new spacing of the background image (1,1,1)
+void ColorLayerImageViewPanel::SetBaseSpacing(double spc[3])
+{
+ _spcBase[0] = spc[0];
+ _spcBase[1] = spc[1];
+ _spcBase[2] = spc[2];
+
+ _spcBase[0] = 1;
+ _spcBase[1] = 1;
+ _spcBase[2] = 1;
+}
+
+// This is the Original spacing of the background image
+void ColorLayerImageViewPanel::SetOriginalSpacing(double spc[3])
+{
+ _spcOrg[0] = spc[0];
+ _spcOrg[1] = spc[1];
+ _spcOrg[2] = spc[2];
+}
+
+// This is the size in pixels of the background image
+void ColorLayerImageViewPanel::SetBaseDimension(int dim[3])
+{
+ _dimBase[0] = dim[0];
+ _dimBase[1] = dim[1];
+ _dimBase[2] = dim[2];
+}
+
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onReadImage(wxCommandEvent& event)
{
// EED ???
// creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB");
// w.ShowModal();
+ printf("EED ColorLayerImageViewPanel::onReadImage ....WARNING... Read dlg. all images creaImageIO ... ???\n");
creaMaracasVisuKernel::OpenImageDialog diag = creaMaracasVisuKernel::OpenImageDialog();
_colorLayerImageView->SetImage( diag.getImageData() );
+ double spc[3];
+ diag.getImageData()->GetSpacing(spc);
+
+ int dim[3];
int ext[6];
diag.getImageData()->GetWholeExtent(ext);
- _sl_SliceImage->SetRange( 0 , ext[5]-ext[4] );
-
+ dim[0] = ext[1]-ext[0];
+ dim[1] = ext[3]-ext[2];
+ dim[2] = ext[5]-ext[4];
+ _sl_SliceImage->SetRange( 0 , dim[2] );
+
+ if ( (spc[0]!=_spcBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2]) ||
+ (dim[0]!=_dimBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2])
+ )
+ {
+
+ bool transformOkDlg;
+ int typeOfTransformation;
+ wxString msg = _T("The image resolution of both images are not compatible. Do you want to tranform it? ");
+ wxDlgTransformByDimensionBySpacingByPixel dlg;
+ dlg.GetTransformType(this,msg,typeOfTransformation,transformOkDlg);
+
+printf("EED ColorLayerImageViewPanel::onReadImage call dialog spc size,dim...???\n");
+
+ if (typeOfTransformation==0) // make dimensions equals
+ {
+ printf("EED ColorLayerImageViewPanel::onReadImage ...WARNNING.... dif size image spc*dim ofnew image ...???\n");
+ spc[0]=_spcBase[0]*_dimBase[0]/dim[0];
+ spc[1]=_spcBase[1]*_dimBase[1]/dim[1];
+ spc[2] = 1;
+ }
+
+ if (typeOfTransformation==1) // make spacing equals
+ {
+ spc[0] = ( _spcBase[0]/spc[0] ) * _spcOrg[0];
+ spc[1] = ( _spcBase[1]/spc[1] ) * _spcOrg[1];
+ spc[2] = ( _spcBase[2]/spc[2] ) * _spcOrg[2];
+ }
+
+ if (typeOfTransformation==2) // make spacing = 1
+ {
+ spc[0] = 1;
+ spc[1] = 1;
+ spc[2] = 1;
+ }
+
+ diag.getImageData()->SetSpacing(spc);
+ } // spc !_spcBase dim!__dimBase
+
_colorLayerImageView->onThreshold();
_colorLayerImageView->GetwxVtkBaseView()->Refresh();
}
-
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onThresholdChange(wxCommandEvent& event)
{
#include "ColorLayerImageView.h"
+//EED 21-08-2010
+class wxDlgTransformByDimensionBySpacingByPixel
+ {
+ public:
+ wxDlgTransformByDimensionBySpacingByPixel();
+ ~wxDlgTransformByDimensionBySpacingByPixel();
+ void GetTransformType(wxWindow *parent , wxString message,int &typeOfTransformation,bool &dlgWxOK) ;
+ };
+
+//-----------------------------------------------------
+
class ColorLayerImageViewPanel
: public wxPanel
{
void onThresholdStop();
void SetColorLayerImageView(ColorLayerImageView* colorLayerImageView);
bool IsVisible();
+ void SetBaseSpacing(double spc[3]);
+ void SetBaseDimension(int dim[3]);
+ void SetOriginalSpacing(double spc[3]);
private:
-
+ int _dimBase[3];
+ double _spcBase[3];
+ double _spcOrg[3];
+
bool _thresholdGo;
ColorLayerImageView *_colorLayerImageView;
wxButton *_btn_ReadImage;
{
public:
LayerImageBase();
- ~LayerImageBase();
+ virtual ~LayerImageBase();
void SetZ(int z);
void SetImage(vtkImageData* image);
void SetwxVtkBaseView(wxVtkBaseView *baseview);
public:
manualViewPoint(wxVtkBaseView *wxvtkbaseview);
- ~manualViewPoint();
+ virtual ~manualViewPoint();
virtual manualViewPoint * Clone();
void CopyAttributesTo( manualViewPoint *cloneObject );
mBarRange::mBarRange(wxWindow *parent, int w, int h)
:wxScrolledWindow(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL)
{
- acceptedClick = true;
+ acceptedClick = true;
_bitmap_bar = NULL;
SetWidth (w);
SetHeight(h);
_initialPoint = 0;
- trianglesHalfWidth = 5;
+ trianglesHalfWidth = 5;
wxColour start_Colour;
wxPoint points[3];
//int largestNumberWidthInPixels = 15; // JPRx
- int pxStart=GetPixelStart();
- int pxEnd=GetPixelEnd();
- int pxActual=GetPixelActual();
+ int pxStart = GetPixelStart();
+ int pxEnd = GetPixelEnd();
+ int pxActual = GetPixelActual();
- int letterHeight = 9;
- int barHeight = 2*letterHeight;
- int tempHeight = _h-(6*letterHeight);
+ int letterHeight= 9;
+ int barHeight = 2*letterHeight;
+ int tempHeight = _h-(6*letterHeight);
if (_visibleLables)
{
- barHeight = (tempHeight>0) ? tempHeight : (int) _h/2;
+ barHeight = (tempHeight>0) ? tempHeight : (int) _h/2;
}
else
- barHeight = _h;
+ barHeight = _h;
wxMemoryDC temp_dc;
temp_dc.SelectObject( *_bitmap_bar );
// 2 Shadow Triangles: Start and End
- points[0].x=_h;
- points[0].y=0;
- points[1].x=0;
- points[1].y=-trianglesHalfWidth-1;
- points[2].x=0;
- points[2].y=trianglesHalfWidth+2;
+ points[0].x = _h;
+ points[0].y = 0;
+ points[1].x = 0;
+ points[1].y = -trianglesHalfWidth-1;
+ points[2].x = 0;
+ points[2].y = trianglesHalfWidth+2;
temp_dc.SetBrush(wxBrush( wxColour(104,104,104),wxSOLID ));
temp_dc.SetPen(wxPen( wxColour(104,104,104),1,wxSOLID ));
temp_dc.DrawPolygon(3,points,0,px1);
temp_dc.DrawPolygon(3,points,0,px2);
// 2 Triangles: Start and End
- points[0].x=_h;
- points[0].y=0;
- points[1].x=0;
- points[1].y=-trianglesHalfWidth;
- points[2].x=0;
- points[2].y=trianglesHalfWidth;
+ points[0].x = _h;
+ points[0].y = 0;
+ points[1].x = 0;
+ points[1].y = -trianglesHalfWidth;
+ points[2].x = 0;
+ points[2].y = trianglesHalfWidth;
//first triangle (start)
if( _selectionMoveId==1 )
{
if(!isComplexBox)
{
- wxStaticText* label = new wxStaticText(this, -1, wxString(_T("")));
- wxStaticText* label2 = new wxStaticText(this, -1, wxString(_T("")));
+// wxStaticText* label = new wxStaticText(this, -1, wxString(_T("")));
+// wxStaticText* label2 = new wxStaticText(this, -1, wxString(_T("")));
checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor")));
img = wxMaracasMultipleVolumeRendererView::getInstance()->getVolumeRenderManager()->getImageData();
}
- wxMaracas_N_ViewersWidget* viewer = new wxMaracas_N_ViewersWidget(frame, img, &type);
+ // wxMaracas_N_ViewersWidget* viewer = new wxMaracas_N_ViewersWidget(frame, img, &type);
+ new wxMaracas_N_ViewersWidget(frame, img, &type);
frame->Show();
}
wxMaracasRenderTabbedPanel* wxMaracasRendererView::getTabbedPanel(int id) throw(char*)
{
int i;
- for(i = 0; i < (tabsVector.size()); i++)
+ for(i = 0; i < (int)tabsVector.size(); i++)
{
if(tabsVector[i]->getPropIdV() == id)
return tabsVector[i];
virtual void onActionButtonPressedHide( wxCommandEvent& event ){
wxList list = sizercontrols->GetChildren();
int i;
- for(i=0; i<list.size();i++){
+ for(i=0; i<(int)list.size();i++){
sizercontrols->Show(i,show);
}
show = !show;
AddActors();
}
+
void PlaneDirectionManager::AddActors(){
- for(int i = 0; i < _vectdata.size();i++){
+ int i;
+ for(i = 0; i < (int)_vectdata.size();i++){
_render->AddViewProp (_vectdata[i]->GetActor());
}
}
+
void PlaneDirectionManager::RemoveAllActorsFromIndex(int n)throw (std::exception){
/*due to incompleate set of points to create the plane
*/
PlaneDirectionManagerData* temp;
bool deletelast = false;
int currentdata = 0;
- for(int i = 0; i < _lstPointsx.size();i++){
+ int i;
+ for(i = 0; i < (int)_lstPointsx.size();i++){
if(i % 3 == 0){
- if(_vectdata.size()>currentdata){
+ if((int)_vectdata.size()>currentdata){
temp = _vectdata[currentdata];
}else{
temp = new PlaneDirectionManagerData(_radio, _colour, _opacity);
RemoveAllActorsFromIndex(currentdata);
}
-void PlaneDirectionManager::UpdateActors(){
- for(int i = 0; i < _vectdata.size();i++){
+void PlaneDirectionManager::UpdateActors()
+{
+ int i;
+ for(i = 0; i < (int)_vectdata.size();i++)
+ {
_vectdata[i]->UpdateActor();
}
}
-void PlaneDirectionManager::addRemoveActor(int index, bool addremove){
-
- if(index < _vectdata.size()){
+void PlaneDirectionManager::addRemoveActor(int index, bool addremove)
+{
+ if(index < (int)_vectdata.size()){
if(addremove){
_render->AddViewProp (_vectdata[index]->GetActor());
}else{
spc[2] = 1;
}
if (ff!=NULL)
- {
- for(int i = 0; i < _vectdata.size();i++){
+ {
+ int i;
+ for(i = 0; i < (int)_vectdata.size();i++){
double* p0 = _vectdata[i]->getPoint0();
double* p1 = _vectdata[i]->getPoint1();