X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fvtk%2Fsrc%2FbbvtkMetaImageWriter.cxx;h=6474b0adf745e0f96f58bb6c56ab3a8238940d58;hb=c49d4bbc66c64ee56a0f7de04ff2e551b3de6a46;hp=ee36755520ce11670fa6acf0a97fc3095d9a9b0e;hpb=d285b5ec732ee1bd21d54dcc545eb8b2ab232617;p=bbtk.git diff --git a/packages/vtk/src/bbvtkMetaImageWriter.cxx b/packages/vtk/src/bbvtkMetaImageWriter.cxx index ee36755..6474b0a 100644 --- a/packages/vtk/src/bbvtkMetaImageWriter.cxx +++ b/packages/vtk/src/bbvtkMetaImageWriter.cxx @@ -13,6 +13,7 @@ #include "vtkDataSetWriter.h" #include "vtkPDataSetWriter.h" #include "vtkXMLWriter.h" +#include namespace bbvtk { @@ -30,12 +31,12 @@ void MetaImageWriter::Save_mhdb( std::string filename , vtkImageData* img ,int 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; @@ -61,12 +62,12 @@ void MetaImageWriter::Save_mhdb( std::string filename , vtkImageData* img ,int { for (k=0;k=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; } @@ -85,16 +86,17 @@ void MetaImageWriter::Save_mhdb( std::string filename , vtkImageData* img ,int 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 @@ -108,9 +110,6 @@ void MetaImageWriter::Save_mhdb( std::string filename , vtkImageData* img ,int //===== 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 @@ -136,10 +135,10 @@ printf("EED vtkMetaImageWriter::Process START\n"); { 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 @@ -155,8 +154,8 @@ printf("EED vtkMetaImageWriter::Process START\n"); 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) //===== @@ -168,32 +167,29 @@ void MetaImageWriter::bbUserSetDefaultValues() 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