From: Eduardo DAVILA Date: Fri, 23 Aug 2013 06:25:24 +0000 (+0200) Subject: 2118 BBTK Feature New High InversCrop X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=03110e730a19cb174f6a820f97b7a972a1ff9fc2;p=bbtk.git 2118 BBTK Feature New High InversCrop --- diff --git a/packages/vtk/src/bbvtkCreateImage.cxx b/packages/vtk/src/bbvtkCreateImage.cxx index 9aa9a46..9bc6d51 100644 --- a/packages/vtk/src/bbvtkCreateImage.cxx +++ b/packages/vtk/src/bbvtkCreateImage.cxx @@ -54,21 +54,23 @@ void CreateImage::Process() // (the one provided in the attribute 'type' of the tag 'input') + printf("EED CreateImage::Process Start\n"); + double spc[6]; int dim[3]; int outputformat = VTK_UNSIGNED_SHORT; - if (bbGetInputOutputFormat()=="VTK_BIT") outputformat = VTK_BIT; - else if (bbGetInputOutputFormat()=="VTK_CHAR") outputformat = VTK_CHAR; + if (bbGetInputOutputFormat()=="VTK_BIT") outputformat = VTK_BIT; + else if (bbGetInputOutputFormat()=="VTK_CHAR") outputformat = VTK_CHAR; else if (bbGetInputOutputFormat()=="VTK_SIGNED_CHAR") outputformat = VTK_SIGNED_CHAR; else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_CHAR") outputformat = VTK_UNSIGNED_CHAR; else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_SHORT") outputformat = VTK_UNSIGNED_SHORT; - else if (bbGetInputOutputFormat()=="VTK_INT") outputformat = VTK_INT; + else if (bbGetInputOutputFormat()=="VTK_INT") outputformat = VTK_INT; else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_INT") outputformat = VTK_UNSIGNED_INT; - else if (bbGetInputOutputFormat()=="VTK_LONG") outputformat = VTK_LONG; + else if (bbGetInputOutputFormat()=="VTK_LONG") outputformat = VTK_LONG; else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_LONG") outputformat = VTK_UNSIGNED_LONG; - else if (bbGetInputOutputFormat()=="VTK_FLOAT") outputformat = VTK_FLOAT; - else if (bbGetInputOutputFormat()=="VTK_DOUBLE") outputformat = VTK_DOUBLE; + else if (bbGetInputOutputFormat()=="VTK_FLOAT") outputformat = VTK_FLOAT; + else if (bbGetInputOutputFormat()=="VTK_DOUBLE") outputformat = VTK_DOUBLE; spc[0] = bbGetInputSpacing()[0]; spc[1] = bbGetInputSpacing()[1]; @@ -84,21 +86,33 @@ void CreateImage::Process() imageoutput->SetDimensions( dim[0], dim[1], dim[2] ); imageoutput->AllocateScalars(); - + int i,j,k; + long sizeBlock; + for (i=0; iSetScalarComponentFromDouble(i,j,k, 0, bbGetInputInitialValue() ); - } // for k - } // for j - } // for i + imageoutput->SetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() ); + } + sizeBlock= dim[0] * imageoutput->GetScalarSize(); + for (j=1; jGetScalarPointer(0,j,0), imageoutput->GetScalarPointer() , sizeBlock ); + } + + sizeBlock= dim[0] * dim[1] * imageoutput->GetScalarSize(); + for (k=0; kGetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer() , sizeBlock ); + } // for k + + imageoutput->Update(); + imageoutput->Modified(); bbSetOutputOut(imageoutput); + printf("EED CreateImage::Process End\n"); + } //===== @@ -114,9 +128,9 @@ void CreateImage::bbUserSetDefaultValues() dim.push_back(250); dim.push_back(250); std::vector spc; - dim.push_back(1.0); - dim.push_back(1.0); - dim.push_back(1.0); + spc.push_back(1.0); + spc.push_back(1.0); + spc.push_back(1.0); bbSetInputDimensions(dim); bbSetInputSpacing(spc); diff --git a/packages/vtk/src/bbvtkCreateImage.h b/packages/vtk/src/bbvtkCreateImage.h index 7e72e8b..5d43aee 100644 --- a/packages/vtk/src/bbvtkCreateImage.h +++ b/packages/vtk/src/bbvtkCreateImage.h @@ -75,7 +75,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(CreateImage,bbtk::AtomicBlackBox); BBTK_INPUT(CreateImage,Dimensions,"[SizeX SizeY SizeZ] of the image ([250 250 250] default)",std::vector,""); BBTK_INPUT(CreateImage,Spacing,"[SpcX SpcY SpcZ] of the image ([1 1 1] default)",std::vector,""); - BBTK_INPUT(CreateImage,OutputFormat,"Image output format: VTK_BIT, VTK_CHAR, VTK_SIGNED_CHAR, VTK_UNSIGNED_CHAR, VTK_SHORT VTK_UNSIGNED_SHORT (default), VTK_INT, VTK_UNSIGNED_INT, VTK_LONG, VTK_UNSIGNED_LONG, VTK_FLOAT, VTK_DOUBLE",std::string,""); + BBTK_INPUT(CreateImage,OutputFormat,"Image output format: VTK_BIT, VTK_CHAR, VTK_SIGNED_CHAR, VTK_UNSIGNED_CHAR, VTK_SHORT, VTK_UNSIGNED_SHORT (default), VTK_INT, VTK_UNSIGNED_INT, VTK_LONG, VTK_UNSIGNED_LONG, VTK_FLOAT, VTK_DOUBLE",std::string,""); BBTK_INPUT(CreateImage,InitialValue,"Initial value inside the image (0 default)",double,""); BBTK_OUTPUT(CreateImage,Out,"Output vtkImageData",vtkImageData*,"");