]> Creatis software - creaMaracasVisu.git/commitdiff
2382 creaMaracasVisu Bug New High Box HistogramView not accept all formats
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 3 Jun 2014 08:22:41 +0000 (10:22 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 3 Jun 2014 08:22:41 +0000 (10:22 +0200)
2345 creaMaracasVisu Feature Test Phase Normal Ruler01XY

bbtk/bbs/appli/exampleRuler01_XY.bbg
bbtk/bbs/appli/exampleRuler01_XY.bbs
bbtk/bbs/boxes/Ruler01_XY.bbg
bbtk/bbs/boxes/Ruler01_XY.bbs
bbtk/src/bbcreaMaracasVisuChangeInformationPoint3Dto2D.cxx [new file with mode: 0644]
bbtk/src/bbcreaMaracasVisuChangeInformationPoint3Dto2D.h [new file with mode: 0644]
bbtk/src/bbmaracasvisuHistogramView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.h

index 06173872bcc1ef7872f38464dfcde4678e1f395b..3c30c40e2f26dc7827c2c7c3f971ed2093e8fcb7 100644 (file)
@@ -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
index 6b992396a758f6392ba096d69b99b2e7a9032477..cb4e6ff7823637b484460ebeef27facdb439d882 100644 (file)
@@ -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
index bc8304e2107b815905336923b975db76b2162388..cc22f517775d82b1c938a0ea74edf56d562367cc 100644 (file)
@@ -150,6 +150,8 @@ PORT
 In4:"p) "
 PORT
 In5:" ang="
+PORT
+In7:"  ."
 FIN_BOX
 BOX
 std:Mul:Box17
index c34de9daaf94e4a167475ed99c29289197af3ea6..3da1b51533a5a43f8f7d5255d7f3cdfdcf397fbc 100644 (file)
@@ -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 (file)
index 0000000..f60814b
--- /dev/null
@@ -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 = " <<bbGetOutputOut() << std::endl;
+  
+}
+//===== 
+// 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::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+
+//   bbSetInputIn(0);
+  
+}
+//===== 
+// 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::bbUserInitializeProcessing()
+{
+
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+
+  
+}
+//===== 
+// 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::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbcreaMaracasVisu
+
+
diff --git a/bbtk/src/bbcreaMaracasVisuChangeInformationPoint3Dto2D.h b/bbtk/src/bbcreaMaracasVisuChangeInformationPoint3Dto2D.h
new file mode 100644 (file)
index 0000000..b124d46
--- /dev/null
@@ -0,0 +1,54 @@
+//===== 
+// 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)
+//===== 
+#ifndef __bbcreaMaracasVisuChangeInformationPoint3Dto2D_h_INCLUDED__
+#define __bbcreaMaracasVisuChangeInformationPoint3Dto2D_h_INCLUDED__
+#include "bbcreaMaracasVisu_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include "wxVtkBaseView.h"
+
+namespace bbcreaMaracasVisu
+{
+
+class bbcreaMaracasVisu_EXPORT ChangeInformationPoint3Dto2D
+ : 
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(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)
+//===== 
+  BBTK_DECLARE_INPUT(InPoint,std::vector<double>);
+  BBTK_DECLARE_INPUT(wxVtkBaseView,wxVtkBaseView*);
+  BBTK_DECLARE_OUTPUT(OutPoint,std::vector<double>);
+  BBTK_DECLARE_OUTPUT(NormalVector,std::vector<double>);
+  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<double>,"");
+ BBTK_INPUT(ChangeInformationPoint3Dto2D,wxVtkBaseView,"wxVtkBaseView",wxVtkBaseView*,"");
+
+ BBTK_OUTPUT(ChangeInformationPoint3Dto2D,OutPoint,"Output Point 2D",std::vector<double>,"");
+ BBTK_OUTPUT(ChangeInformationPoint3Dto2D,NormalVector,"NormalVector (default 0 0 1)",std::vector<double>,"");
+
+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__
+
index f41c189f4618ff12f364b988e1d0ef8c8ef270e1..c510b41105c9279a9fbe95a1e09310d967ede91b 100644 (file)
@@ -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");
 }
 
 //------------------------------------------------
index 616d2f4247865fc4d48352b3311f549b4d99571c..4909265441e96e2403ab2d58ab2aceea360a6780 100644 (file)
@@ -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 "<<maxLevelOfGrey<<" minLevelOfGrey "<<minLevelOfGrey<<std::endl;
        /*
         Image Size
@@ -208,11 +215,25 @@ void pHistogram::setPoints(vtkImageData* imageData)
                */
                //double p=((float)*dataImagePointer-minLevelOfGrey);
                //j=p*k;
-               
-               j=getIndex(*dataImagePointer);
+               if (imageData->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<<j<<std::endl;
                dataHistogramPointer[j]++;
-               dataImagePointer++;
        }
        /*
        BORRAME
@@ -238,7 +259,7 @@ hash por getting the index for the histogram vector of the original
 image
 @gValue: Level of grey for which wants the index in the histogrram
 */
-int pHistogram::getIndex(int gValue)
+int pHistogram::getIndex(double gValue)
 {
 
        double p=((double)gValue-minLevelOfGrey)/(maxLevelOfGrey-minLevelOfGrey);
index a7689bd6547d91ad904082990c84eadef5d3c43b..a57b4ddfcca5884f84e91702d41fdbff1fd831c7 100644 (file)
@@ -115,7 +115,7 @@ class pHistogram //:public wxObject
                  hash por getting the index for the histogram vector of the original
                  image
                */
-               int getIndex(int gValue);
+               int getIndex(double gValue);
                /*
                Setting the size
                */
@@ -163,15 +163,15 @@ class pHistogram //:public wxObject
                /*
                 Maximum Level of grey
                */
-               int maxLevelOfGrey;
+               double maxLevelOfGrey;
                /*
                 Minimum Level of grey
                */
-               int minLevelOfGrey;
+               double minLevelOfGrey;
                /*
                 image size
                */
-               int sizeImage;
+               long int sizeImage;
 
        //DECLARE_CLASS (pHistogram)
 };