From: davila Date: Thu, 20 Nov 2014 13:00:14 +0000 (+0100) Subject: #2482 creaMaracasVisu Bug New High - ColorLayer refresh missing. The MPR is not... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=creaMaracasVisu.git;a=commitdiff_plain;h=63a0a21e6736a800c58442edd531c91d75e71694 #2482 creaMaracasVisu Bug New High - ColorLayer refresh missing. The MPR is not refresh at the same time --- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h index 35a1c49..945c801 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h @@ -78,15 +78,15 @@ class ColorLayerImageViewPanel void SetActive(bool active); private: - bool _active; - int _fitting_mode; + bool _active; + int _fitting_mode; - int _dimBase[3]; - double _spcBase[3]; - double _spcOrg[3]; + int _dimBase[3]; + double _spcBase[3]; + double _spcOrg[3]; - bool _thresholdGo; - ColorLayerImageViewManager *_colorLayerImageViewManager; + bool _thresholdGo; + ColorLayerImageViewManager *_colorLayerImageViewManager; // ColorLayerImageView *_colorLayerImageView; wxButton *_btn_ReadImage; wxSlider *_opacity; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index 3b89d1a..eb70d3e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@ -33,8 +33,7 @@ #include "wxMPRBaseData.h" #include "wxVtk2DBaseView.h" #include "wxVTKRenderWindowInteractor.h" - - +#include "vtkTextProperty.h" //--------------------------------------------------------------------------------------------- @@ -85,103 +84,6 @@ private: }; -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- - -ColorLayerImageBasevtkInteractor::ColorLayerImageBasevtkInteractor(LayerImageBase* layerImageBase) -{ - _state = false; - _stateKey = false; - _layerImageBase = layerImageBase; - -} - -//--------------------------------------------------------------------------------------------- -ColorLayerImageBasevtkInteractor::~ColorLayerImageBasevtkInteractor() -{ -} - -//--------------------------------------------------------------------------------------------- -bool ColorLayerImageBasevtkInteractor::OnChar() -{ - return true; -} - - -//--------------------------------------------------------------------------------------------- -bool ColorLayerImageBasevtkInteractor::OnMouseMove() // vitual -{ - printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove start \n"); - - vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor(); - - // For example in ManualPaint Action - // This is not working, because the order of insertion events mecanism (_vtkInteractorStyleBaseView) - // Layer first Paint after. - // the only way to make it works is to take the axes an paint. this force a first SetParent_refresh_waiting() -// if ( this->_vtkInteractorStyleBaseView->GetParent_refresh_waiting() == true ) - - if ( interactor->GetControlKey()==1 ) // EED This if for ManaulPaint Interaction compatibility - { - printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove need Refresh \n" ); - _layerImageBase->onThreshold(); - _layerImageBase->GetvtkImageReslice()->Modified(); - } else { - printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove NOT need Refresh \n" ); - } - - - if ( (_state==true) && (_layerImageBase->GetActorPresent()) ) - { - wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*) _vtkInteractorStyleBaseView->GetWxVtk2DBaseView(); - wxVTKRenderWindowInteractor *wxVTKiren = wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor(); - int px, py; - wxVTKiren->GetEventPosition(px, py); - -// int typeView = 1; - double X = (double) px; - double Y = (double) py; - double Z = wxvtk2Dbaseview->GetActualSlice(); -// wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z,true, typeView); - wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z, true); - -// _manualPaintControler->PaintImage((int) X, (int) Y, (int) Z); - - _layerImageBase->SetX( (int)X ); - _layerImageBase->SetY( (int)Y ); - _layerImageBase->SetZ( (int)Z ); - _layerImageBase->onThreshold(); -// _layerImageBase->Refresh(); - - this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting(); - - if (_vtkInteractorStyleBaseView->GetRefresh_waiting()==true) - { - _layerImageBase->GetvtkImageReslice()->Modified(); - } - printf("EED ColorLayerImageBasevtkInteractor::YESSSSSS \n"); - } - return true; -} - -//--------------------------------------------------------------------------------------------- -bool ColorLayerImageBasevtkInteractor::OnRightButtonDown() // virtual -{ - printf("EED ColorLayerImageBasevtkInteractor::OnRightButtonDown \n"); - _state=true; - return true; -} - - -//--------------------------------------------------------------------------------------------- -bool ColorLayerImageBasevtkInteractor::OnRightButtonUp() // virtual -{ - printf("EED ColorLayerImageBasevtkInteractor::OnRightButtonUp \n"); - _state=false; - return true; -} - //--------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------- @@ -445,9 +347,11 @@ void LayerImageBase::onThreshold() // _scalarbarActor->SetLookupTable( _thresholdTable ); _scalarbarActor->SetLookupTable( _thresholdMapper->GetLookupTable() ); - _scalarbarActor->SetTitle("Value"); - _scalarbarActor->SetNumberOfLabels(5); + _scalarbarActor->SetNumberOfLabels(4); + int fontsize = _scalarbarActor->GetLabelTextProperty()->GetFontSize(); + _scalarbarActor->GetLabelTextProperty()->SetFontSize(fontsize/2); + // _scalarbarActor->SetTextPad(4); ?? } // _image diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h index e9e92aa..fec399c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h @@ -63,8 +63,8 @@ public: virtual bool OnRightButtonUp(); private: - bool _state; - bool _stateKey; + bool _state; + bool _stateKey; LayerImageBase* _layerImageBase; protected: diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/Histogram.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/Histogram.cxx index d9134e4..8526658 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/Histogram.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/Histogram.cxx @@ -119,13 +119,19 @@ END_EVENT_TABLE() xValues=(double*)malloc(NUM_POINTS*sizeof(double)); yValues=(double*)malloc(NUM_POINTS*sizeof(double)); - unsigned short* histogramPointer=(unsigned short*)histogramImageData->GetScalarPointer(0,0,0); + double* histogramPointer=(double*)histogramImageData->GetScalarPointer(0,0,0); - for(int i=0; i< histogramSize; i++) + int i; + for(i=0; i< histogramSize; i++) { xValues[i]=i; - yValues[i]=log( (double) histogramPointer[i])*10; - } + if (histogramPointer[i]==0) + { + yValues[i]=0; + } else { + yValues[i]=log(histogramPointer[i])*10; + } // if histogramPointer + } // for i pGraphicalFunction* histogramFunction=plotter->getFunctionForVectors(xValues,histogramSize,yValues,histogramSize); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialog.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialog.h index 038f464..5ac1e39 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialog.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialog.h @@ -206,40 +206,40 @@ private: /* ok Button */ - //wxButton *okBtn; + //wxButton *okBtn; wxBitmapButton *okBtn; /* cancel Button */ - //wxButton *cancelBtn; + //wxButton *cancelBtn; wxBitmapButton *cancelBtn; /* save Button */ - wxButton *saveDataBtn; + wxButton *saveDataBtn; /* Load Button */ - wxButton *loadDataBtn; + wxButton *loadDataBtn; /* Refresh Button */ - wxButton *refreshBtn; + wxButton *refreshBtn; - wxPanel* _panextracontrols; + wxPanel *_panextracontrols; // the user had pressed refresh bool refreshed; - vtkColorTransferFunction *_ctfun; + vtkColorTransferFunction *_ctfun; vtkPiecewiseFunction *_tfun; - vtkVolumeRayCastMapper *volumeMapper; + vtkVolumeRayCastMapper *volumeMapper; vtkVolume *newvol; //things to refresh - //wxVtkMPR3DView *wxvtkmpr3Dview; - //wxVtkClipping3DView *wxvtkclipping3Dview; + //wxVtkMPR3DView *wxvtkmpr3Dview; + //wxVtkClipping3DView *wxvtkclipping3Dview; wxSizer* getControls(bool extracontrols = false); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx index 999ff6f..9d80407 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx @@ -128,7 +128,8 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint void HistogramWidget::initializeHistogram(vtkImageData* img){ - if(histogram ==NULL){ + if(histogram ==NULL) + { histogram= new pHistogram(img); } //draw @@ -160,13 +161,18 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint xValues=(double*)malloc(NUM_POINTS*sizeof(double)); yValues=(double*)malloc(NUM_POINTS*sizeof(double)); - unsigned short* histogramPointer=(unsigned short*)histogramImageData->GetScalarPointer(0,0,0); - - for(int i=0; i< histogramSize; i++) + double* histogramPointer=(double*)histogramImageData->GetScalarPointer(0,0,0); + int i; + for(i=0; i< histogramSize; i++) { xValues[i]=i; - yValues[i]=log( (double) histogramPointer[i]); - } + if (histogramPointer[i]==0) + { + yValues[i]=0; + } else { + yValues[i]=log(histogramPointer[i])*10; + } // histogramPointer + } // for i pGraphicalFunction* histogramFunction=plotter->getFunctionForVectors(xValues,histogramSize,yValues,histogramSize); @@ -196,7 +202,6 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint */ void HistogramWidget::drawTransferenceFunction() { - double xValues[5],yValues[5]; //xValues int maxValueGrey=histogram->getMaximumLevelOfGrey(); @@ -214,7 +219,7 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint yValues[4]=0; pGraphicalFunction * tf = plotter ->getFunctionForVectors( xValues, 5, yValues, 5 ); - printf("EED %p HistogramWidget::drawTransferenceFunction %p\n", this , tf); + printf("EED %p HistogramWidget::drawTransferenceFunction %p\n", this , tf); // Including and drawing the created function in the plotter if (tf) { @@ -225,11 +230,13 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint tf->SetShowPoints(true); idTransferenceFunction=plotter->addFunction( tf ); if(type==1) + { plotter->addFunctionToMove(tf); + } wxPen mypen(*wxBLACK,0.5, wxSOLID ); mypen.SetWidth(2); tf->SetPen( mypen ); - } + } // if tf } /* @@ -241,7 +248,8 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint GetClientSize(&scrX,&scrY); plotter->SetSize(scrX,scrY); pGraphicalFunction* actual=plotter->getFunction(idTransferenceFunction); - if(actual!=NULL){ + if(actual!=NULL) + { actual->setScreens(scrX,scrY); actual->setScales(); } @@ -262,12 +270,12 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint void HistogramWidget::getTransferenceFunctionPoint(int index,int& x,int& y) { pGraphicalFunction* tf=plotter->getFunction(idTransferenceFunction); - if(tf) + if(tf!=NULL) { - wxNode* pnode=tf->GetPointAt(index); - pFunctionPoint* point=(pFunctionPoint*)pnode->GetData(); - x=point->getRealX(); - y=point->getRealY(); + wxNode* pnode = tf->GetPointAt(index); + pFunctionPoint* point = (pFunctionPoint*)pnode->GetData(); + x = point->getRealX(); + y = point->getRealY(); } } /* @@ -288,21 +296,21 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint /* get a color int the bqr color */ - void HistogramWidget:: getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue) + void HistogramWidget::getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue) { - double tmp=x; + double tmp = x; plotter->getBarColorDataAt(index,tmp,red,green,blue); - x=(int)tmp; + x = (int)tmp; } /* Returns the maximum value ot the histogram that is show to the user */ float HistogramWidget::getMaxShowedPorcentage() { - float porcentageMaxX=plotter->getMaxShowedPorcentage(); - pGraphicalFunction* histogramFunction=plotter->getFunction(idHistogram); - int min=histogramFunction->getMinX(); - float x=porcentageMaxX*(histogramFunction->getMaxX()-min); + float porcentageMaxX = plotter->getMaxShowedPorcentage(); + pGraphicalFunction* histogramFunction = plotter->getFunction(idHistogram); + int min = histogramFunction->getMinX(); + float x = porcentageMaxX*(histogramFunction->getMaxX()-min); return min+ x; } /* @@ -310,10 +318,10 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint */ float HistogramWidget::getMinShowedPorcentage() { - float porcentageMinX=plotter->getMinShowedPorcentage(); - pGraphicalFunction* histogramFunction=plotter->getFunction(idHistogram); - int min=histogramFunction->getMinX(); - float x=porcentageMinX*(histogramFunction->getMaxX()-min); + float porcentageMinX = plotter->getMinShowedPorcentage(); + pGraphicalFunction* histogramFunction = plotter->getFunction(idHistogram); + int min = histogramFunction->getMinX(); + float x = porcentageMinX*(histogramFunction->getMaxX()-min); return min+ x; } /* @@ -321,11 +329,11 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint */ float HistogramWidget::getActualShowedPorcentage() { - float porcentageActualX=plotter->getMinShowedPorcentage(); - pGraphicalFunction* histogramFunction=plotter->getFunction(idHistogram); - int min=histogramFunction->getMinX(); - float x=porcentageActualX*(histogramFunction->getMaxX()-min); - return min+ x; + float porcentageActualX = plotter->getMinShowedPorcentage(); + pGraphicalFunction* histogramFunction = plotter->getFunction(idHistogram); + int min = histogramFunction->getMinX(); + float x = porcentageActualX*(histogramFunction->getMaxX()-min); + return min + x; } //--------------------------------------- // setting data in transferences function @@ -339,7 +347,10 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint bool result=false; pGraphicalFunction* tf=plotter->getFunction(idTransferenceFunction); //printf("EED %p HistogramWidget::addPointToTransferenceFunction tp%p x%f y%f %d\n",this, tf, x ,y, idTransferenceFunction); - if (tf!=NULL) { result=tf->AddPoint(x,y); } + if (tf!=NULL) + { + result=tf->AddPoint(x,y); + } // if tf return result; } @@ -403,26 +414,29 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint void HistogramWidget::setTransferenceFunctionHasPoints(bool hasPoints) { - transferenceFunctionHasPoints=hasPoints; + transferenceFunctionHasPoints = hasPoints; } void HistogramWidget::setTransferenceFunctionHasColor(bool hasColorPoints) { - transferenceFunctionHasPoints=hasColorPoints; + transferenceFunctionHasPoints = hasColorPoints; } + int HistogramWidget::getHistogramSize() { return histogramSize; } + void HistogramWidget::setType(int type) { - this->type=type; + this->type = type; } /** ** Returns two vectors, the grey level of the point and its value, the value is between [0,1] **/ - void HistogramWidget::GetValuesPointsFunction(std::vector& greylevel,std::vector& value){ + void HistogramWidget::GetValuesPointsFunction(std::vector& greylevel,std::vector& value) + { plotter->GetValuesPointsFunction(greylevel,value,histogramSize); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/mBarRange.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/mBarRange.cxx index ffdbcde..b92232f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/mBarRange.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/mBarRange.cxx @@ -279,14 +279,15 @@ void mBarRange::SetHeight(int h) int mBarRange::filtreValue(int value) { if(value<_min) + { value = _min; - else if (value>_max) + } else if (value>_max) { value = _max; - + } return value; } - +//---------------------------------------------------------------------------- int mBarRange::GetStart() { return _start; @@ -297,11 +298,17 @@ int mBarRange::GetStart() void mBarRange::SetStart(int newstart) { _start = filtreValue(newstart); - if (_start>_end) { _start=_end; } + + if (_start>_end) + { + _start=_end; + } + if (_in_rangeProperty==true) { if (_start>_actual) { _start=_actual; } } + RefreshForce(); } //---------------------------------------------------------------------------- @@ -321,7 +328,10 @@ void mBarRange::SetEnd(int newend) if (_end<_start) { _end=_start; } if (_in_rangeProperty==true) { - if (_end<_actual) { _end=_actual; } + if (_end<_actual) + { + _end=_actual; + } // _end } RefreshForce(); } @@ -351,6 +361,7 @@ int mBarRange::GetTrianglesHalfWidth() { return trianglesHalfWidth; } + //---------------------------------------------------------------------------- void mBarRange::SetTrianglesHalfWidth(int nwTriHalfWidth) { @@ -363,9 +374,7 @@ void mBarRange::OnSize( wxSizeEvent &WXUNUSED(event) ) if(_orientation) { SetWidth( rectTotal.GetWidth() - deviceEndMargin ); - } - else - { + } else { SetWidth( rectTotal.GetHeight() - deviceEndMargin); } _selectionMoveId = -1; @@ -385,7 +394,8 @@ void mBarRange::Refresh(bool eraseBackground, const wxRect* rect) //---------------------------------------------------------------------------- void mBarRange::OnPaint( wxPaintEvent &WXUNUSED(event) ) { - if (_bitmap_bar!=NULL){ + if (_bitmap_bar!=NULL) + { //repaint rectangle if(_orientation) { @@ -417,9 +427,8 @@ void mBarRange::OnPaint( wxPaintEvent &WXUNUSED(event) ) // dc.Blit(0,_w, _h+deviceStart_y+200, _w+deviceStart_x+200-deviceEndMargin, &temp_dc, deviceStart_y,_w+deviceStart_x); // } - } - } + } // _bitmap_bar } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx index 1c5aa11..cbfee52 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx @@ -62,18 +62,18 @@ //---------------------------------------------------------------------------- pHistogram::pHistogram(std::string filePath) { - path=filePath; - points= vtkImageData::New(); - size=100; - sizeImage=0; + path = filePath; + points = vtkImageData::New(); + size = 100; + sizeImage = 0; buildHistogram(); } pHistogram::pHistogram(vtkImageData* imageData) { - points= vtkImageData::New(); - size=100; - sizeImage=0; + points = vtkImageData::New(); + size = 100; + sizeImage = 0; //cast /* vtkImageCast* cast= vtkImageCast::New(); @@ -85,19 +85,19 @@ pHistogram::pHistogram(vtkImageData* imageData) buildHistogram(imageData); } +//---------------------------------------------------------------------------- pHistogram::~pHistogram() { if(points!=NULL)points->Delete(); } -//---------------------------------------------------------------------------- -// Methods -//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- void pHistogram::setImagePath(std::string filePath) { path=filePath; } +//---------------------------------------------------------------------------- void pHistogram::buildHistogram() { /* @@ -121,7 +121,6 @@ void pHistogram::buildHistogram() imageData->GetScalarRange(range); initializePoints(size); setPoints(imageData); - } /* @@ -144,7 +143,7 @@ void pHistogram::initializePoints(int xDimension) //setting image data of the points points->SetDimensions(xDimension,1,1); //EED points->SetScalarTypeToUnsignedShort(); - points->SetScalarTypeToShort(); + points->SetScalarTypeToDouble(); points->AllocateScalars(); points->Update(); } @@ -170,31 +169,32 @@ printf("EED pHistogram::setPoints colums:%d\n", (int)(resulttable->GetNumberOfCo /* Pointers */ - unsigned short* dataImagePointerUS = NULL; - short* dataImagePointerS = NULL; - double* dataImagePointerD = NULL; - short* dataHistogramPointer = NULL; + char* dataImagePointerC = (char*)imageData->GetScalarPointer(0,0,0); + unsigned char* dataImagePointerUC = (unsigned char*)imageData->GetScalarPointer(0,0,0); + short* dataImagePointerS = (short*)imageData->GetScalarPointer(0,0,0); + unsigned short* dataImagePointerUS = (unsigned short*)imageData->GetScalarPointer(0,0,0); + float* dataImagePointerF = (float*)imageData->GetScalarPointer(0,0,0); + double* dataImagePointerD = (double*)imageData->GetScalarPointer(0,0,0); - dataImagePointerUS = (unsigned short*)imageData->GetScalarPointer(0,0,0); - dataImagePointerS = (short*)imageData->GetScalarPointer(0,0,0); - dataImagePointerD = (double*)imageData->GetScalarPointer(0,0,0); - - dataHistogramPointer = (short*)points->GetScalarPointer(0,0,0); + double* dataHistogramPointer = (double*)points->GetScalarPointer(0,0,0); /* Range of greys */ double range[2]; if(imageData==NULL) - range[1]=1; - else + { + range[1] = 1; + } else { imageData->GetScalarRange(range); + } // imageData + /* Setting the minimun and maximum levels of grey */ - maxLevelOfGrey=range[1]; - minLevelOfGrey=range[0]; + maxLevelOfGrey = range[1]; + minLevelOfGrey = range[0]; //std::cout<<"maxLevelOfGrey "<GetNumberOfCo int ext[6]; imageData->GetExtent(ext); int sx,sy,sz; - sx=ext[1]+1; - sy=ext[3]+1; - sz=ext[5]+1; + sx=ext[1]-ext[0]+1; + sy=ext[3]-ext[2]+1; + sz=ext[5]-ext[4]+1; sizeImage=sx*sy*sz; @@ -217,49 +217,75 @@ printf("EED pHistogram::setPoints colums:%d\n", (int)(resulttable->GetNumberOfCo dataHistogramPointer[i]=0; } - /* - Constructing the Histogram - */ - //int k=size/(maxLevelOfGrey-minLevelOfGrey); int j=0; - for(i=0;iGetScalarType()==VTK_CHAR) { - /* - hashing the histogram - */ - //double p=((float)*dataImagePointer-minLevelOfGrey); - //j=p*k; - if (imageData->GetScalarType()==VTK_UNSIGNED_SHORT) - { - j=getIndex(*dataImagePointerUS); - dataImagePointerUS++; - } - if (imageData->GetScalarType()==VTK_SHORT) + for(i=0;iGetScalarType()==VTK_UNSIGNED_CHAR) + { + for(i=0;iGetScalarType()==VTK_SHORT) + { + for(i=0;iGetScalarType()==VTK_DOUBLE) + dataHistogramPointer[j]++; + } // for i + } // SHORT + + if (imageData->GetScalarType()==VTK_UNSIGNED_SHORT) + { + for(i=0;iGetScalarType()==VTK_FLOAT) + { + for(i=0;iGetScalarType()==VTK_DOUBLE) + { + for(i=0;iGetScalarPointer(0,0,0); - + double* dataHistogramPointer = dataHistogramPointer=(double*)points->GetScalarPointer(0,0,0); return dataHistogramPointer[gValue]; } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotter.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotter.cxx index 22b7dcd..bddea23 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotter.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotter.cxx @@ -439,18 +439,17 @@ void pPlotter::onBarrange(wxCommandEvent& event) */ void pPlotter::onActualChange_Bar(wxCommandEvent& event) { - text.Clear(); - text = _T( "Last event was on min-max bar: Actual triangle moved to: " ); int lastActual_X = barrange->GetActual(); - - text << lastActual_X; color_bar ->setRealX_vertical_line (lastActual_X); - m_plot->setRealGuideX (lastActual_X); - color_bar -> RefreshForce(); + + m_plot->setRealGuideX (lastActual_X); m_plot->UpdateAll(); + text.Clear(); + text = _T( "Last event was on min-max bar: Actual triangle moved to: " ); + text << lastActual_X; sendTMessage(text); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx index b07e111..5115e2d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx @@ -75,26 +75,26 @@ IMPLEMENT_CLASS(pPlotterWindow, mpWindow) //---------------------------------------------------------------------------- BEGIN_EVENT_TABLE(pPlotterWindow,mpWindow) -EVT_MOTION (pPlotterWindow::onMouseMove) -EVT_LEFT_DCLICK(pPlotterWindow::onChangeActual) -EVT_LEFT_DOWN(pPlotterWindow::onAddPoint) -EVT_MENU(pwID_DELPOINT, pPlotterWindow::onDeletePoint) -EVT_MENU(pwID_SHOWPOINTS, pPlotterWindow::onShowPoints) -EVT_MENU(pwID_STARTDRAWING, pPlotterWindow::onStartDrawing) -//EVT_MENU(pwID_DELFUNCTION,pPlotterWindow::onDeleteFunction) -EVT_MENU(pwID_STOPDRAWING, pPlotterWindow::onStopDrawing) -EVT_MENU(pwID_ADDNEWPOINT, pPlotterWindow::onAddNewPoint) -EVT_MENU(pwID_NOSHOWPOINTS, pPlotterWindow::onNoShowPoints) -EVT_MENU(pwID_MYZOOMOUT,pPlotterWindow::onMyZoomOut) -EVT_MENU(pwID_MYZOOMIN,pPlotterWindow::onMyZoomIn) -EVT_MENU(pwID_SPLINE,pPlotterWindow::onSplinePoints) -EVT_MENU(pwID_LINE,pPlotterWindow::onLine) -EVT_MENU(pwID_SAVE,pPlotterWindow::onSave) -EVT_MENU(pwID_LOAD,pPlotterWindow::onLoad) -EVT_MENU(pwID_CHANGECOLOR,pPlotterWindow::onChangeColor) -EVT_MENU( mpID_LINE_GUIDES, pPlotterWindow::OnGuideLines) -EVT_MENU( pwID_TRASLATEACTUALFUNCTION, pPlotterWindow::onMoveFunction) -EVT_LEFT_UP(pPlotterWindow::onLeftUp) + EVT_MOTION (pPlotterWindow::onMouseMove) + EVT_LEFT_DCLICK(pPlotterWindow::onChangeActual) + EVT_LEFT_DOWN(pPlotterWindow::onAddPoint) + EVT_MENU(pwID_DELPOINT, pPlotterWindow::onDeletePoint) + EVT_MENU(pwID_SHOWPOINTS, pPlotterWindow::onShowPoints) + EVT_MENU(pwID_STARTDRAWING, pPlotterWindow::onStartDrawing) + //EVT_MENU(pwID_DELFUNCTION,pPlotterWindow::onDeleteFunction) + EVT_MENU(pwID_STOPDRAWING, pPlotterWindow::onStopDrawing) + EVT_MENU(pwID_ADDNEWPOINT, pPlotterWindow::onAddNewPoint) + EVT_MENU(pwID_NOSHOWPOINTS, pPlotterWindow::onNoShowPoints) + EVT_MENU(pwID_MYZOOMOUT,pPlotterWindow::onMyZoomOut) + EVT_MENU(pwID_MYZOOMIN,pPlotterWindow::onMyZoomIn) + EVT_MENU(pwID_SPLINE,pPlotterWindow::onSplinePoints) + EVT_MENU(pwID_LINE,pPlotterWindow::onLine) + EVT_MENU(pwID_SAVE,pPlotterWindow::onSave) + EVT_MENU(pwID_LOAD,pPlotterWindow::onLoad) + EVT_MENU(pwID_CHANGECOLOR,pPlotterWindow::onChangeColor) + EVT_MENU( mpID_LINE_GUIDES, pPlotterWindow::OnGuideLines) + EVT_MENU( pwID_TRASLATEACTUALFUNCTION, pPlotterWindow::onMoveFunction) + EVT_LEFT_UP(pPlotterWindow::onLeftUp) END_EVENT_TABLE() //---------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.h index 38d0dec..64c29bf 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.h @@ -394,7 +394,7 @@ private: Use to Show Information */ - wxTextCtrl *m_log; + wxTextCtrl *m_log; wxString text; /*