#include "vtkDataSetWriter.h"
#include "vtkPDataSetWriter.h"
#include "vtkXMLWriter.h"
+#include <math.h>
namespace bbvtk
{
int elementType=img->GetScalarType();
img->GetExtent(ext);
- dim[0]=ext[1]-ext[0]+1;
- dim[1]=ext[3]-ext[2]+1;
- dim[2]=ext[5]-ext[4]+1;
- int bsx=ceil((double)dim[0]/(double)sizeB);
- int bsy=ceil((double)dim[1]/(double)sizeB);
- int bsz=ceil((double)dim[2]/(double)sizeB);
+ dim[0] = ext[1]-ext[0]+1;
+ dim[1] = ext[3]-ext[2]+1;
+ dim[2] = ext[5]-ext[4]+1;
+ int bsx = ceil((double)dim[0]/(double)sizeB);
+ int bsy = ceil((double)dim[1]/(double)sizeB);
+ int bsz = ceil((double)dim[2]/(double)sizeB);
int voi[6];
std::string filenameBlock;
std::string filenameBlockVti;
{
for (k=0;k<bsz;k++)
{
- voi[0]=i*sizeB;
- voi[1]=voi[0]+(sizeB-1);
- voi[2]=j*sizeB;
- voi[3]=voi[2]+(sizeB-1);
- voi[4]=k*sizeB;
- voi[5]=voi[4]+(sizeB-1);
+ voi[0] = i*sizeB;
+ voi[1] = voi[0]+(sizeB-1);
+ voi[2] = j*sizeB;
+ voi[3] = voi[2]+(sizeB-1);
+ voi[4] = k*sizeB;
+ voi[5] = voi[4]+(sizeB-1);
if (voi[1]>=dim[0]) { voi[1]=dim[0]-1; }
if (voi[3]>=dim[1]) { voi[3]=dim[1]-1; }
if (voi[5]>=dim[2]) { voi[5]=dim[2]-1; }
w->Write();
w->Delete();
+/* Borrame
filenameBlockVti=filenameBlock+"-ZLib.vti";
vtkXMLImageDataWriter *writer = vtkXMLImageDataWriter::New();
writer->SetDataModeToBinary();
- writer->SetCompressionLevel(5);
+// writer->SetCompressionLevel(5);
writer->SetCompressorTypeToZLib();
writer->SetFileName( filenameBlockVti.c_str() );
writer->SetInputData( bbGetInputIn() );
writer->Write();
-
-
+*/
+
extract->Delete();
} // for k
} // for j
//=====
void MetaImageWriter::Process()
{
-
-printf("EED vtkMetaImageWriter::Process START\n");
-
// THE MAIN PROCESSING METHOD BODY
// Here we simply set the input 'In' value to the output 'Out'
// And print out the output value
{
Save_mhdb( userGivenName , bbGetInputIn() , bbGetInputSizeBlock() );
} else {
- if (userGivenName.substr(userGivenName.size()-4) != ".mhd") //JPR
+ if (!((userGivenName.substr(userGivenName.size()-4) == ".mhd") || (userGivenName.substr(userGivenName.size()-4) == ".mha"))) //JPR
{
userGivenName += ".mhd";
- }
+ }
vtkMetaImageWriter* w = vtkMetaImageWriter::New();
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
w->Delete();
} // .mhdb
} // bbGetInputIn()!=NULL
-printf("EED vtkMetaImageWriter::Process END\n");
}
+
//=====
// 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)
//=====
bbSetInputCompression(false);
bbSetInputSizeBlock(20);
}
+
//=====
// 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 MetaImageWriter::bbUserInitializeProcessing()
{
-
// THE INITIALIZATION METHOD BODY :
// Here does nothing
// but this is where you should allocate the internal/output pointers
-// if any
-
-
+// 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 MetaImageWriter::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
// if any
-
-}
}
-// EO namespace bbvtk
+
+} // EO namespace bbvtk