From: Eduardo DAVILA Date: Tue, 13 Sep 2016 14:09:11 +0000 (+0200) Subject: #3013 BBTK Feature New Normal - package vtk box InvertCrop Type option X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=5936201782e55f5e736090bd01b4d5f3b64c9a4e;p=bbtk.git #3013 BBTK Feature New Normal - package vtk box InvertCrop Type option --- diff --git a/packages/vtk/src/bbvtkCreateImage.cxx b/packages/vtk/src/bbvtkCreateImage.cxx index e408b93..074e9de 100644 --- a/packages/vtk/src/bbvtkCreateImage.cxx +++ b/packages/vtk/src/bbvtkCreateImage.cxx @@ -61,18 +61,30 @@ void CreateImage::Process() if (bbGetInputOutputFormat()=="VTK_BIT") outputformat = VTK_BIT; // 1 - else if (bbGetInputOutputFormat()=="VTK_CHAR") outputformat = VTK_CHAR; // 2 + else if (bbGetInputOutputFormat()=="VTK_CHAR") outputformat = VTK_CHAR; // 2 + else if (bbGetInputOutputFormat()=="MET_CHAR") outputformat = VTK_CHAR; // 2 else if (bbGetInputOutputFormat()=="VTK_SIGNED_CHAR") outputformat = VTK_SIGNED_CHAR; // 15 + else if (bbGetInputOutputFormat()=="MET_UCHAR") outputformat = VTK_UNSIGNED_CHAR; // 3 else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_CHAR") outputformat = VTK_UNSIGNED_CHAR; // 3 else if (bbGetInputOutputFormat()=="VTK_SHORT") outputformat = VTK_SHORT; // 4 + else if (bbGetInputOutputFormat()=="MET_SHORT") outputformat = VTK_SHORT; // 4 else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_SHORT") outputformat = VTK_UNSIGNED_SHORT; // 5 + else if (bbGetInputOutputFormat()=="MET_USHORT") outputformat = VTK_UNSIGNED_SHORT; // 5 else if (bbGetInputOutputFormat()=="VTK_INT") outputformat = VTK_INT; // 6 + else if (bbGetInputOutputFormat()=="MET_INT") outputformat = VTK_INT; // 6 else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_INT") outputformat = VTK_UNSIGNED_INT; // 7 + else if (bbGetInputOutputFormat()=="MEY_UINT") outputformat = VTK_UNSIGNED_INT; // 7 else if (bbGetInputOutputFormat()=="VTK_LONG") outputformat = VTK_LONG; // 8 + else if (bbGetInputOutputFormat()=="MET_LONG") outputformat = VTK_LONG; // 8 else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_LONG") outputformat = VTK_UNSIGNED_LONG; // 9 + else if (bbGetInputOutputFormat()=="MET_ULONG") outputformat = VTK_UNSIGNED_LONG; // 9 else if (bbGetInputOutputFormat()=="VTK_FLOAT") outputformat = VTK_FLOAT; // 10 - else if (bbGetInputOutputFormat()=="VTK_DOUBLE") outputformat = VTK_DOUBLE; // 11 - + else if (bbGetInputOutputFormat()=="MET_FLOAT") outputformat = VTK_FLOAT; // 10 + else if (bbGetInputOutputFormat()=="VTK_DOUBLE") outputformat = VTK_DOUBLE; // 11 + else if (bbGetInputOutputFormat()=="MET_DOUBLE") outputformat = VTK_DOUBLE; // 11 + + + spc[0] = bbGetInputSpacing()[0]; spc[1] = bbGetInputSpacing()[1]; spc[2] = bbGetInputSpacing()[2]; diff --git a/packages/vtk/src/bbvtkInversCrop.cxx b/packages/vtk/src/bbvtkInversCrop.cxx index 7d0962f..97963bc 100644 --- a/packages/vtk/src/bbvtkInversCrop.cxx +++ b/packages/vtk/src/bbvtkInversCrop.cxx @@ -28,7 +28,6 @@ void InversCrop::Process() if ((bbGetInputImageFix()!=NULL) && (bbGetInputImageMove()!=NULL) ) { -printf("EED InversCrop::Process ScalarType %d %d \n", bbGetInputImageFix()->GetScalarType(), bbGetInputImageMove()->GetScalarType() ); if ( bbGetInputImageFix()->GetScalarType()==bbGetInputImageMove()->GetScalarType() ) { // Creating Image @@ -39,13 +38,21 @@ printf("EED InversCrop::Process ScalarType %d %d \n", bbGetInputImageFix()->Get dim[0]= ext[1]-ext[0]+1; dim[1]= ext[3]-ext[2]+1; dim[2]= ext[5]-ext[4]+1; - - _imageoutput = vtkImageData::New(); - _imageoutput->Initialize(); - _imageoutput->SetScalarType( bbGetInputImageFix()->GetScalarType() ); - _imageoutput->SetSpacing( bbGetInputImageFix()->GetSpacing() ); - _imageoutput->SetDimensions( dim[0], dim[1], dim[2] ); - _imageoutput->AllocateScalars(); + + if (bbGetInputType()==0) + { + _imageoutput = vtkImageData::New(); + _imageoutput->Initialize(); + _imageoutput->SetScalarType( bbGetInputImageFix()->GetScalarType() ); + _imageoutput->SetSpacing( bbGetInputImageFix()->GetSpacing() ); + _imageoutput->SetDimensions( dim[0], dim[1], dim[2] ); + _imageoutput->AllocateScalars(); + } + if (bbGetInputType()==1) + { + _imageoutput=bbGetInputImageFix(); + } + // Duplicating Fix Image long sizeimage = dim[0]*dim[1]*dim[2]*bbGetInputImageFix()->GetScalarSize(); @@ -110,6 +117,7 @@ void InversCrop::bbUserSetDefaultValues() // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 + bbSetInputType(0); bbSetInputImageFix(NULL); bbSetInputImageMove(NULL); diff --git a/packages/vtk/src/bbvtkInversCrop.h b/packages/vtk/src/bbvtkInversCrop.h index 63fb7ef..5ed7d05 100644 --- a/packages/vtk/src/bbvtkInversCrop.h +++ b/packages/vtk/src/bbvtkInversCrop.h @@ -21,6 +21,7 @@ class bbvtk_EXPORT InversCrop //===== // 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(Type,int); BBTK_DECLARE_INPUT(ImageFix,vtkImageData*); BBTK_DECLARE_INPUT(ImageMove,vtkImageData*); BBTK_DECLARE_INPUT(Origin,std::vector); @@ -40,6 +41,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(InversCrop,bbtk::AtomicBlackBox); BBTK_DESCRIPTION("Invers Crop, Both images had to have the same format"); BBTK_CATEGORY(""); + BBTK_INPUT(InversCrop,Type,"(default 0) 0=Create image for de result FixImage+MoveImage, 1=Use the FixImage as output",int,""); BBTK_INPUT(InversCrop,ImageFix,"Fix Image (necesary). Need same format of ImageMove",vtkImageData*,""); BBTK_INPUT(InversCrop,ImageMove,"Move Image (necesary). Need same format of ImageFix",vtkImageData*,""); BBTK_INPUT(InversCrop,Origin,"Position to be put de Move Image (default 0,0,0 )",std::vector,""); diff --git a/packages/wxvtk/bbs/boxes/bbIsoSurfaceWidget.bbg b/packages/wxvtk/bbs/boxes/bbIsoSurfaceWidget.bbg index ca42713..8a66b66 100644 --- a/packages/wxvtk/bbs/boxes/bbIsoSurfaceWidget.bbg +++ b/packages/wxvtk/bbs/boxes/bbIsoSurfaceWidget.bbg @@ -65,7 +65,7 @@ BOX wx:LayoutLine:controls ISEXEC:FALSE 97.896195:-54.335314:-900.000000 -155.456195:-64.335314:-900.000000 +143.471195:-64.335314:-900.000000 PORT Orientation:"HORIZONTAL" FIN_BOX