// (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];
imageoutput->SetDimensions( dim[0], dim[1], dim[2] );
imageoutput->AllocateScalars();
-
+
int i,j,k;
+ long sizeBlock;
+
for (i=0; i<dim[0]; i++)
{
- for (j=0; j<dim[1]; j++)
- {
- for (k=0; k<dim[2]; k++)
- {
- imageoutput->SetScalarComponentFromDouble(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; j<dim[1]; j++)
+ {
+ memcpy( imageoutput->GetScalarPointer(0,j,0), imageoutput->GetScalarPointer() , sizeBlock );
+ }
+
+ sizeBlock= dim[0] * dim[1] * imageoutput->GetScalarSize();
+ for (k=0; k<dim[2]; k++)
+ {
+ memcpy( imageoutput->GetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer() , sizeBlock );
+ } // for k
+
+ imageoutput->Update();
+ imageoutput->Modified();
bbSetOutputOut(imageoutput);
+ printf("EED CreateImage::Process End\n");
+
}
//=====
dim.push_back(250);
dim.push_back(250);
std::vector<double> 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);
BBTK_INPUT(CreateImage,Dimensions,"[SizeX SizeY SizeZ] of the image ([250 250 250] default)",std::vector<int>,"");
BBTK_INPUT(CreateImage,Spacing,"[SpcX SpcY SpcZ] of the image ([1 1 1] default)",std::vector<double>,"");
- 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*,"");