]> Creatis software - bbtk.git/commitdiff
#3013 BBTK Feature New Normal - package vtk box InvertCrop Type option
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 13 Sep 2016 14:09:11 +0000 (16:09 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 13 Sep 2016 14:09:11 +0000 (16:09 +0200)
packages/vtk/src/bbvtkCreateImage.cxx
packages/vtk/src/bbvtkInversCrop.cxx
packages/vtk/src/bbvtkInversCrop.h
packages/wxvtk/bbs/boxes/bbIsoSurfaceWidget.bbg

index e408b930e474f95f4509b3ddd7c9badb96840367..074e9de8a37d013d7a1f10b8ae6963035ab529ff 100644 (file)
@@ -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];
index 7d0962f05e94adc731073c9da1a9b7a7eb4762e7..97963bca7327d6d4f3edc07a6ac10e4ba8019d7f 100644 (file)
@@ -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);
 
index 63fb7ef3a733fc8b54646486541591a5c922711d..5ed7d052da0cbf0e07107b07bbd6f95f5baf9a8f 100644 (file)
@@ -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<int>);
@@ -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<int>,"");
index ca427133d8fa410d49bb07acb3634e0d7adae0ba..8a66b6637feaf44407bcf011837a1b8521b172e4 100644 (file)
@@ -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