From 3cfec8aa0ab76e72a0a4682155c671d5ff75ad0b Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 13 Apr 2016 08:35:11 +0200 Subject: [PATCH] #2913 creaVtk Feature New Normal - new box MHDFileInfo --- .../bbs/appli/examplePlaneWidget.bbg | 79 +++++++---- .../bbs/appli/examplePlaneWidget.bbs | 48 ++++--- bbtk_creaVtk_PKG/src/bbcreaVtkMHDFileInfo.cxx | 126 ++++++++++++++++++ bbtk_creaVtk_PKG/src/bbcreaVtkMHDFileInfo.h | 58 ++++++++ .../src/bbcreaVtkReadMHDPlane.cxx | 4 +- 5 files changed, 270 insertions(+), 45 deletions(-) create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkMHDFileInfo.cxx create mode 100644 bbtk_creaVtk_PKG/src/bbcreaVtkMHDFileInfo.h diff --git a/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget.bbg b/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget.bbg index 7b72cd0..5614185 100644 --- a/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget.bbg +++ b/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget.bbg @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBG BlackBox Diagram file -# - /home/davila/Creatis/creaVtk/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget.bbg +# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget.bbg # ---------------------------------- APP_START @@ -9,62 +9,89 @@ DESCRIPTION:Description ?? AUTHOR:Author ?? COMPLEXBOX:FALSE COMPLEXINPUTS:0 -BOXES:5 +BOXES:7 BOX vtk:LoadHola:Box00 ISEXEC:FALSE --24.200550:45.257301:-900.000000 -21.374450:35.257301:-900.000000 +-13.068558:72.467386:-900.000000 +32.506442:62.467386:-900.000000 FIN_BOX BOX creaMaracasVisu:ViewerNV:Box01 ISEXEC:FALSE --17.749601:21.905419:-900.000000 -42.890399:11.905419:-900.000000 +-6.976145:43.852021:-900.000000 +38.598855:33.852021:-900.000000 +FIN_BOX +BOX +wx:LayoutSplit:Box02 +ISEXEC:TRUE +-9.670623:-63.555971:-900.000000 +35.904377:-73.555971:-900.000000 PORT -nTypeView:"5" +Orientation:"H" +FIN_BOX +BOX +wx:LayoutLine:Box03 +ISEXEC:FALSE +-61.355811:-33.011090:-900.000000 +-15.780811:-43.011090:-900.000000 FIN_BOX BOX -creaVtk:PlaneWidget:Box02 +wx:OutputText:Box04 ISEXEC:FALSE --48.010561:-16.304165:-900.000000 --2.435561:-26.304165:-900.000000 +-98.129016:-17.240669:-900.000000 +-52.554016:-27.240669:-900.000000 PORT -Active:"true" +Title:"Center" FIN_BOX BOX -wx:CommandButton:Box03 +wx:OutputText:Box05 ISEXEC:FALSE -32.053294:9.088705:-900.000000 -77.628294:-0.911295:-900.000000 +-45.570165:-16.275073:-900.000000 +0.004835:-26.275073:-900.000000 PORT -Label:"Run" +Title:"normal" FIN_BOX BOX -wx:LayoutSplit:Box04 -ISEXEC:TRUE -13.089075:-50.759046:-900.000000 -58.664075:-60.759046:-900.000000 +creaVtk:PlaneWidget:Box06 +ISEXEC:FALSE +-60.391943:23.106661:-900.000000 +-14.816943:13.106661:-900.000000 PORT -Proportion:"10" +Active:"true" FIN_BOX -CONNECTIONS:6 +CONNECTIONS:11 CONNECTION Box00:Out:Box01:In NumberOfControlPoints:0 CONNECTION -Box01:Renderer1:Box02:Renderer +Box01:Widget:Box02:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box03:Widget:Box02:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box05:Widget:Box03:Widget2 +NumberOfControlPoints:0 +CONNECTION +Box04:Widget:Box03:Widget1 +NumberOfControlPoints:0 +CONNECTION +Box01:Renderer1:Box06:Renderer +NumberOfControlPoints:0 +CONNECTION +Box00:Out:Box06:In NumberOfControlPoints:0 CONNECTION -Box00:Out:Box02:In +Box06:Center:Box04:In NumberOfControlPoints:0 CONNECTION -Box03:Widget:Box04:Widget1 +Box06:Normal:Box05:In NumberOfControlPoints:0 CONNECTION -Box01:Widget:Box04:Widget2 +Box06:BoxChange:Box04:BoxExecute NumberOfControlPoints:0 CONNECTION -Box03:BoxChange:Box02:BoxExecute +Box06:BoxChange:Box05:BoxExecute NumberOfControlPoints:0 APP_END diff --git a/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget.bbs b/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget.bbs index 27ff209..584882e 100644 --- a/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget.bbs +++ b/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget.bbs @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.4 BBS BlackBox Script -# - /home/davila/Creatis/creaVtk/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget.bbs +# - /tmpEED/creaTools/creatools_source/creaVtk/bbtk_creaVtk_PKG/bbs/appli/examplePlaneWidget.bbs # ---------------------------------- # BBTK GEditor Script @@ -10,41 +10,55 @@ include std include itkvtk include vtk include creaMaracasVisu -include creaVtk include wx +include creaVtk author "Author ??" description "Description ??" category "" -new LoadHola Box00 +new vtk:LoadHola Box00 + +new creaMaracasVisu:ViewerNV Box01 -new ViewerNV Box01 - set Box01.nTypeView "5" +new wx:LayoutSplit Box02 + set Box02.Orientation "H" -new PlaneWidget Box02 - set Box02.Active "true" +new wx:LayoutLine Box03 -new CommandButton Box03 - set Box03.Label "Run" +new wx:OutputText Box04 + set Box04.Title "Center" -new LayoutSplit Box04 - set Box04.Proportion "10" +new wx:OutputText Box05 + set Box05.Title "normal" + +new creaVtk:PlaneWidget Box06 + set Box06.Active "true" connect Box00.Out Box01.In -connect Box01.Renderer1 Box02.Renderer +connect Box01.Widget Box02.Widget2 + +connect Box03.Widget Box02.Widget1 + +connect Box05.Widget Box03.Widget2 + +connect Box04.Widget Box03.Widget1 + +connect Box01.Renderer1 Box06.Renderer + +connect Box00.Out Box06.In -connect Box00.Out Box02.In +connect Box06.Center Box04.In -connect Box03.Widget Box04.Widget1 +connect Box06.Normal Box05.In -connect Box01.Widget Box04.Widget2 +connect Box06.BoxChange Box04.BoxExecute -connect Box03.BoxChange Box02.BoxExecute +connect Box06.BoxChange Box05.BoxExecute # Complex input ports -exec Box04 +exec Box02 diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkMHDFileInfo.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkMHDFileInfo.cxx new file mode 100644 index 0000000..015e4ba --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkMHDFileInfo.cxx @@ -0,0 +1,126 @@ +//===== +// 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 "bbcreaVtkMHDFileInfo.h" +#include "bbcreaVtkPackage.h" +namespace bbcreaVtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,MHDFileInfo) +BBTK_BLACK_BOX_IMPLEMENTATION(MHDFileInfo,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 MHDFileInfo::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 = " < LstDimSize; + LstDimSize.push_back(dimX); + LstDimSize.push_back(dimY); + LstDimSize.push_back(dimZ); + + std::vector LstSpacing; + LstSpacing.push_back((double)spcX); + LstSpacing.push_back((double)spcY); + LstSpacing.push_back((double)spcZ); + + std::vector LstOffset; + LstOffset.push_back((double)ox); + LstOffset.push_back((double)oy); + LstOffset.push_back((double)oz); + + bbSetOutputDim( dim ); + bbSetOutputDimSize( LstDimSize ); + bbSetOutputElementType( formattype ); + bbSetOutputElementSpacing( LstSpacing ); + bbSetOutputOffset( LstOffset ); + bbSetOutputHeaderSize( headersize ); + +} +//===== +// 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 MHDFileInfo::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 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 MHDFileInfo::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 MHDFileInfo::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbcreaVtk + + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkMHDFileInfo.h b/bbtk_creaVtk_PKG/src/bbcreaVtkMHDFileInfo.h new file mode 100644 index 0000000..890c407 --- /dev/null +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkMHDFileInfo.h @@ -0,0 +1,58 @@ +//===== +// 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 __bbcreaVtkMHDFileInfo_h_INCLUDED__ +#define __bbcreaVtkMHDFileInfo_h_INCLUDED__ +#include "bbcreaVtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +namespace bbcreaVtk +{ + +class bbcreaVtk_EXPORT MHDFileInfo + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(MHDFileInfo,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(FileName,std::string); + BBTK_DECLARE_OUTPUT(Dim,int); + BBTK_DECLARE_OUTPUT(DimSize,std::vector); + BBTK_DECLARE_OUTPUT(ElementType,std::string); + BBTK_DECLARE_OUTPUT(ElementSpacing,std::vector); + BBTK_DECLARE_OUTPUT(Offset,std::vector); + BBTK_DECLARE_OUTPUT(HeaderSize,long int); + 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(MHDFileInfo,bbtk::AtomicBlackBox); + BBTK_NAME("MHDFileInfo"); + BBTK_AUTHOR("Info-Dev"); + BBTK_DESCRIPTION("No Description."); + BBTK_CATEGORY("empty"); + + BBTK_INPUT(MHDFileInfo,FileName,"MHD file name",std::string,""); + + BBTK_OUTPUT(MHDFileInfo,Dim,"Dimension",int,""); + BBTK_OUTPUT(MHDFileInfo,DimSize,"Size",std::vector,""); + BBTK_OUTPUT(MHDFileInfo,ElementType,"Format type",std::string,""); + BBTK_OUTPUT(MHDFileInfo,ElementSpacing,"Spacing",std::vector,""); + BBTK_OUTPUT(MHDFileInfo,Offset,"Offset",std::vector,""); + BBTK_OUTPUT(MHDFileInfo,HeaderSize,"Format type",long int,""); + +BBTK_END_DESCRIBE_BLACK_BOX(MHDFileInfo); +//===== +// 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 bbcreaVtk + +#endif // __bbcreaVtkMHDFileInfo_h_INCLUDED__ + diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx index 53b6691..6bb42f7 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx @@ -90,8 +90,8 @@ void ReadMHDPlane::Process() newHeaderSize = sx*sy*bbGetInputSlice(); if (bbGetInputSlice()>=sz) {ok=false;} } // if - if (strncmp("ElementType = MET_CHAR",mystring,24)==0) { newHeaderSize=newHeaderSize*1; } - if (strncmp("ElementType = MET_UCHAR",mystring,24)==0) { newHeaderSize=newHeaderSize*1; } + if (strncmp("ElementType = MET_CHAR",mystring,22)==0) { newHeaderSize=newHeaderSize*1; } + if (strncmp("ElementType = MET_UCHAR",mystring,23)==0) { newHeaderSize=newHeaderSize*1; } if (strncmp("ElementType = MET_USHORT",mystring,24)==0) { newHeaderSize=newHeaderSize*2; } if (strncmp("ElementType = MET_USHORT",mystring,24)==0) { newHeaderSize=newHeaderSize*2; } if (strncmp("ElementType = MET_SHORT",mystring,23)==0) { newHeaderSize=newHeaderSize*2; } -- 2.45.0