From: Eduardo DAVILA Date: Tue, 3 Jun 2014 08:22:41 +0000 (+0200) Subject: 2382 creaMaracasVisu Bug New High Box HistogramView not accept all formats X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=f2db891d132e926233f6a4d7f1b5a8e615cc7c4b;p=creaMaracasVisu.git 2382 creaMaracasVisu Bug New High Box HistogramView not accept all formats 2345 creaMaracasVisu Feature Test Phase Normal Ruler01XY --- diff --git a/bbtk/bbs/appli/exampleRuler01_XY.bbg b/bbtk/bbs/appli/exampleRuler01_XY.bbg index 0617387..3c30c40 100644 --- a/bbtk/bbs/appli/exampleRuler01_XY.bbg +++ b/bbtk/bbs/appli/exampleRuler01_XY.bbg @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBG BlackBox Diagram file -# - /home/davila/Creatis/All/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleRuler01_XY.bbg +# - /home/davila/Creatis/creaTools/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleRuler01_XY.bbg # ---------------------------------- APP_START @@ -9,54 +9,132 @@ DESCRIPTION:Description ?? AUTHOR:Author ?? COMPLEXBOX:FALSE COMPLEXINPUTS:0 -BOXES:7 +BOXES:17 BOX creaMaracasVisu:ViewerNV:Box01 ISEXEC:FALSE -50.383173:32.032968:-900.000000 -111.023173:22.032968:-900.000000 +79.866200:50.067798:-900.000000 +140.506200:40.067798:-900.000000 FIN_BOX BOX vtk:LoadHola:Box02 ISEXEC:FALSE -22.231304:70.181477:-900.000000 -67.806304:60.181477:-900.000000 +55.791771:86.177587:-900.000000 +101.366771:76.177587:-900.000000 FIN_BOX BOX wx:LayoutTab:Box04 ISEXEC:FALSE --17.670654:-30.060089:-900.000000 -39.889346:-40.060089:-900.000000 +-33.721024:-109.351051:-900.000000 +23.838976:-119.351051:-900.000000 FIN_BOX BOX wx:LayoutSplit:Box05 ISEXEC:TRUE -78.616470:-67.713286:-900.000000 -124.191470:-77.713286:-900.000000 +76.915956:-140.803447:-900.000000 +122.490956:-150.803447:-900.000000 PORT Orientation:"H" FIN_BOX BOX itk:ImageReader:Box06 ISEXEC:FALSE --35.424377:73.221521:-900.000000 -10.150623:63.221521:-900.000000 +-45.304327:88.276684:-900.000000 +0.270673:78.276684:-900.000000 PORT In:"/tmpEED/tmpIulia/coeur_t1_VGpost_z1_pag0001_USHORT_spc-tmpEED.mhd" FIN_BOX BOX vtk:vtkImageDataPointerRelay:Box07 ISEXEC:FALSE --2.184398:50.126177:-900.000000 -68.990602:40.126177:-900.000000 +57.565779:70.670201:-900.000000 +128.740779:60.670201:-900.000000 FIN_BOX BOX creaMaracasVisu:Ruler01_XY_Widget:Box09 ISEXEC:FALSE -39.925354:-6.480031:-900.000000 -85.500354:-16.480031:-900.000000 +50.863528:26.572260:-900.000000 +96.438528:16.572260:-900.000000 FIN_BOX -CONNECTIONS:9 +BOX +creaMaracasVisu:PanelButtonContainerSettings:Box10 +ISEXEC:FALSE +-57.656044:-17.197832:-900.000000 +13.518956:-27.197832:-900.000000 +PORT +ButtonDescription:"Ruler 01" +PORT +ButtonName:"Ruler 01" +PORT +GroupName:"Ruler" +FIN_BOX +BOX +creaMaracasVisu:PanelButtonContainer:Box11 +ISEXEC:FALSE +-79.899600:-82.362357:-900.000000 +-8.724600:-92.362357:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ContourControlPoints_Widget:Box13 +ISEXEC:FALSE +114.360380:24.301866:-900.000000 +185.535380:14.301866:-900.000000 +FIN_BOX +BOX +std:MagicBox:Box14 +ISEXEC:TRUE +116.103305:-6.968508:-900.000000 +161.678305:-16.968508:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:PanelButtonContainerSettings:Box15 +ISEXEC:FALSE +-68.845012:-53.380556:-900.000000 +2.329988:-63.380556:-900.000000 +PORT +ButtonDescription:"Ruler 02" +PORT +ButtonName:"Ruler 02" +PORT +GroupName:"Ruler" +FIN_BOX +BOX +toolsbbtk:ImageVtkPropertiesWidget:Box16 +ISEXEC:FALSE +-23.191903:52.199106:-900.000000 +47.983097:42.199106:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:PanelButtonContainerSettings:Box17 +ISEXEC:FALSE +-47.001046:11.642034:-900.000000 +24.173954:1.642034:-900.000000 +PORT +ButtonDescription:"Image properties" +PORT +ButtonName:"Image properties" +PORT +GroupName:"Information" +FIN_BOX +BOX +wx:LayoutLine:Box18 +ISEXEC:FALSE +-117.896873:-16.920169:-900.000000 +-60.336873:-26.920169:-900.000000 +FIN_BOX +BOX +wx:LayoutLine:Box19 +ISEXEC:FALSE +-111.282956:11.161994:-900.000000 +-53.722956:1.161994:-900.000000 +FIN_BOX +BOX +std:MagicBox:Box20 +ISEXEC:FALSE +-120.177863:-52.869017:-900.000000 +-74.602863:-62.869017:-900.000000 +FIN_BOX +CONNECTIONS:22 CONNECTION Box04:Widget:Box05:Widget1 NumberOfControlPoints:0 @@ -76,12 +154,51 @@ CONNECTION Box01:Point:Box09:Point NumberOfControlPoints:0 CONNECTION -Box01:Renderer4:Box09:vtkRenderer +Box02:Out:Box07:In NumberOfControlPoints:0 CONNECTION -Box09:Widget:Box04:Widget1 +Box11:Widget:Box04:Widget1 NumberOfControlPoints:0 CONNECTION -Box02:Out:Box07:In +Box09:Widget:Box10:Widget +NumberOfControlPoints:0 +CONNECTION +Box01:Renderer4:Box13:vtkRenderer +NumberOfControlPoints:0 +CONNECTION +Box01:wxVtkBaseView4:Box13:wxvtkbaseview +NumberOfControlPoints:0 +CONNECTION +Box13:BoxChange2:Box14:BoxExecute +NumberOfControlPoints:0 +CONNECTION +Box13:Widget_Contour:Box15:Widget +NumberOfControlPoints:0 +CONNECTION +Box15:Out:Box11:In +NumberOfControlPoints:0 +CONNECTION +Box10:Out:Box15:In +NumberOfControlPoints:0 +CONNECTION +Box07:Out:Box16:in +NumberOfControlPoints:0 +CONNECTION +Box16:widget:Box17:Widget +NumberOfControlPoints:0 +CONNECTION +Box10:Widget:Box18:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box17:Widget:Box19:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box17:Out:Box10:In +NumberOfControlPoints:0 +CONNECTION +Box15:Widget:Box20:In +NumberOfControlPoints:0 +CONNECTION +Box01:Renderer4:Box09:vtkRenderer NumberOfControlPoints:0 APP_END diff --git a/bbtk/bbs/appli/exampleRuler01_XY.bbs b/bbtk/bbs/appli/exampleRuler01_XY.bbs index 6b99239..cb4e6ff 100644 --- a/bbtk/bbs/appli/exampleRuler01_XY.bbs +++ b/bbtk/bbs/appli/exampleRuler01_XY.bbs @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBS BlackBox Script -# - /home/davila/Creatis/All/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleRuler01_XY.bbs +# - /home/davila/Creatis/creaTools/creatools_source/creaMaracasVisu/bbtk/bbs/appli/exampleRuler01_XY.bbs # ---------------------------------- # BBTK GEditor Script @@ -12,6 +12,8 @@ include creaMaracasVisu include vtk include wx include itk +include std +include toolsbbtk author "Author ??" description "Description ??" @@ -33,6 +35,35 @@ new vtkImageDataPointerRelay Box07 new Ruler01_XY_Widget Box09 +new PanelButtonContainerSettings Box10 + set Box10.ButtonDescription "Ruler 01" + set Box10.ButtonName "Ruler 01" + set Box10.GroupName "Ruler" + +new PanelButtonContainer Box11 + +new ContourControlPoints_Widget Box13 + +new MagicBox Box14 + +new PanelButtonContainerSettings Box15 + set Box15.ButtonDescription "Ruler 02" + set Box15.ButtonName "Ruler 02" + set Box15.GroupName "Ruler" + +new ImageVtkPropertiesWidget Box16 + +new PanelButtonContainerSettings Box17 + set Box17.ButtonDescription "Image properties" + set Box17.ButtonName "Image properties" + set Box17.GroupName "Information" + +new LayoutLine Box18 + +new LayoutLine Box19 + +new MagicBox Box20 + connect Box04.Widget Box05.Widget1 @@ -46,13 +77,40 @@ connect Box01.BoxChange Box09.BoxExecuteRulerInterface connect Box01.Point Box09.Point -connect Box01.Renderer4 Box09.vtkRenderer +connect Box02.Out Box07.In -connect Box09.Widget Box04.Widget1 +connect Box11.Widget Box04.Widget1 -connect Box02.Out Box07.In +connect Box09.Widget Box10.Widget + +connect Box01.Renderer4 Box13.vtkRenderer + +connect Box01.wxVtkBaseView4 Box13.wxvtkbaseview + +connect Box13.BoxChange2 Box14.BoxExecute + +connect Box13.Widget_Contour Box15.Widget + +connect Box15.Out Box11.In + +connect Box10.Out Box15.In + +connect Box07.Out Box16.in + +connect Box16.widget Box17.Widget + +connect Box10.Widget Box18.Widget1 + +connect Box17.Widget Box19.Widget1 + +connect Box17.Out Box10.In + +connect Box15.Widget Box20.In + +connect Box01.Renderer4 Box09.vtkRenderer # Complex input ports exec Box05 +exec Box14 diff --git a/bbtk/bbs/boxes/Ruler01_XY.bbg b/bbtk/bbs/boxes/Ruler01_XY.bbg index bc8304e..cc22f51 100644 --- a/bbtk/bbs/boxes/Ruler01_XY.bbg +++ b/bbtk/bbs/boxes/Ruler01_XY.bbg @@ -150,6 +150,8 @@ PORT In4:"p) " PORT In5:" ang=" +PORT +In7:" ." FIN_BOX BOX std:Mul:Box17 diff --git a/bbtk/bbs/boxes/Ruler01_XY.bbs b/bbtk/bbs/boxes/Ruler01_XY.bbs index c34de9d..3da1b51 100644 --- a/bbtk/bbs/boxes/Ruler01_XY.bbs +++ b/bbtk/bbs/boxes/Ruler01_XY.bbs @@ -57,6 +57,7 @@ new ConcatStrings Box16 set Box16.In2 "u (" set Box16.In4 "p) " set Box16.In5 " ang=" + set Box16.In7 " ." new Mul Box17 diff --git a/bbtk/src/bbcreaMaracasVisuChangeInformationPoint3Dto2D.cxx b/bbtk/src/bbcreaMaracasVisuChangeInformationPoint3Dto2D.cxx new file mode 100644 index 0000000..f60814b --- /dev/null +++ b/bbtk/src/bbcreaMaracasVisuChangeInformationPoint3Dto2D.cxx @@ -0,0 +1,74 @@ +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +#include "bbcreaMaracasVisuChangeInformationPoint3Dto2D.h" +#include "bbcreaMaracasVisuPackage.h" +namespace bbcreaMaracasVisu +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ChangeInformationPoint3Dto2D) +BBTK_BLACK_BOX_IMPLEMENTATION(ChangeInformationPoint3Dto2D,bbtk::AtomicBlackBox); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void ChangeInformationPoint3Dto2D::Process() +{ + +// THE MAIN PROCESSING METHOD BODY +// Here we simply set the input 'In' value to the output 'Out' +// And print out the output value +// INPUT/OUTPUT ACCESSORS ARE OF THE FORM : +// void bbSet{Input|Output}NAME(const TYPE&) +// const TYPE& bbGet{Input|Output}NAME() const +// Where : +// * NAME is the name of the input/output +// (the one provided in the attribute 'name' of the tag 'input') +// * TYPE is the C++ type of the input/output +// (the one provided in the attribute 'type' of the tag 'input') + + +// bbSetOutputOut( bbGetInputIn() ); +// std::cout << "Output value = " <); + BBTK_DECLARE_INPUT(wxVtkBaseView,wxVtkBaseView*); + BBTK_DECLARE_OUTPUT(OutPoint,std::vector); + BBTK_DECLARE_OUTPUT(NormalVector,std::vector); + BBTK_PROCESS(Process); + void Process(); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(ChangeInformationPoint3Dto2D,bbtk::AtomicBlackBox); + BBTK_NAME("ChangeInformationPoint3Dto2D"); + BBTK_AUTHOR("Info-Dev Creatis"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(ChangeInformationPoint3Dto2D,InPoint,"Input Point 3D",std::vector,""); + BBTK_INPUT(ChangeInformationPoint3Dto2D,wxVtkBaseView,"wxVtkBaseView",wxVtkBaseView*,""); + + BBTK_OUTPUT(ChangeInformationPoint3Dto2D,OutPoint,"Output Point 2D",std::vector,""); + BBTK_OUTPUT(ChangeInformationPoint3Dto2D,NormalVector,"NormalVector (default 0 0 1)",std::vector,""); + +BBTK_END_DESCRIBE_BLACK_BOX(ChangeInformationPoint3Dto2D); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +} +// EO namespace bbcreaMaracasVisu + +#endif // __bbcreaMaracasVisuChangeInformationPoint3Dto2D_h_INCLUDED__ + diff --git a/bbtk/src/bbmaracasvisuHistogramView.cxx b/bbtk/src/bbmaracasvisuHistogramView.cxx index f41c189..c510b41 100644 --- a/bbtk/src/bbmaracasvisuHistogramView.cxx +++ b/bbtk/src/bbmaracasvisuHistogramView.cxx @@ -36,11 +36,13 @@ BBTK_BLACK_BOX_IMPLEMENTATION(HistogramView,bbtk::WxBlackBox); //------------------------------------------------ void HistogramView::Process() { +printf("EED HistogramView::Process Start \n"); if (firsttime==true){ firsttime=false; // histogram_wxwidget = new Histogram( wxpanel , -1, wxPoint(0,0), wxSize(400,400),wxNO_BORDER ); histogram_wxwidget->Configure( bbGetInputIn() ); } +printf("EED HistogramView::Process End \n"); } //------------------------------------------------ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx index 616d2f4..4909265 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx @@ -142,7 +142,8 @@ void pHistogram::initializePoints(int xDimension) { //setting image data of the points points->SetDimensions(xDimension,1,1); - points->SetScalarTypeToUnsignedShort(); +//EED points->SetScalarTypeToUnsignedShort(); + points->SetScalarTypeToShort(); points->AllocateScalars(); points->Update(); } @@ -155,11 +156,17 @@ void pHistogram::setPoints(vtkImageData* imageData) /* Pointers */ - unsigned short* dataImagePointer=NULL; - unsigned short* dataHistogramPointer=NULL; + unsigned short* dataImagePointerUS = NULL; + short* dataImagePointerS = NULL; + double* dataImagePointerD = NULL; - dataImagePointer=(unsigned short*)imageData->GetScalarPointer(0,0,0); - dataHistogramPointer=(unsigned short*)points->GetScalarPointer(0,0,0); + short* dataHistogramPointer = NULL; + + 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); /* Range of greys @@ -172,8 +179,8 @@ void pHistogram::setPoints(vtkImageData* imageData) /* Setting the minimun and maximum levels of grey */ - maxLevelOfGrey=(int)range[1]; - minLevelOfGrey=(int)range[0]; + maxLevelOfGrey=range[1]; + minLevelOfGrey=range[0]; //std::cout<<"maxLevelOfGrey "<GetScalarType()==VTK_UNSIGNED_SHORT) + { + j=getIndex(*dataImagePointerUS); + dataImagePointerUS++; + } + if (imageData->GetScalarType()==VTK_SHORT) + { + j=getIndex(*dataImagePointerS); + dataImagePointerS++; + } + if (imageData->GetScalarType()==VTK_DOUBLE) + { + j=getIndex(*dataImagePointerD); + dataImagePointerD++; + } +//EED j=getIndex(*dataImagePointer); + //std::cout<