#include <vtkExtractVOI.h>
#include <vtkMetaImageWriter.h>
+#include "vtkJSONImageWriter.h"
+#include "vtkXMLImageDataWriter.h"
+#include "vtkXMLDataSetWriter.h"
+#include "vtkDataSetWriter.h"
+#include "vtkPDataSetWriter.h"
+#include "vtkXMLWriter.h"
+
namespace bbvtk
{
int bsz=ceil((double)dim[2]/(double)sizeB);
int voi[6];
std::string filenameBlock;
+ std::string filenameBlockVti;
if (filename.substr(filename.size()-5) == ".mhdb")
{
std::string cmd;
- cmd="rm -rf "+filename;
+// cmd="rm -rf "+filename;
system( cmd.c_str() );
cmd="mkdir "+filename;
system( cmd.c_str() );
}
std::string fileinfoname=filename+"/info.dat";
- FILE *ff=fopen(fileinfoname.c_str(),"r");
+ FILE *ff=fopen(fileinfoname.c_str(),"w");
fprintf(ff,"SizeBlock = %d\n",sizeB);
fprintf(ff,"DimSize = %d %d %d\n" , dim[0],dim[1],dim[2] );
fprintf(ff,"ElementType = %d\n", elementType );
extract->UpdateWholeExtent();
extract->Modified();
extract->Update();
+ filenameBlock =filename+"/mhdb-"+ std::to_string(i)+"-"+ std::to_string(j)+"-"+ std::to_string(k)+".mha";
vtkMetaImageWriter* w = vtkMetaImageWriter::New();
w->SetInputData( extract->GetOutput() );
w->SetCompression(true);
w->SetFileDimensionality(bbGetInputIn()->GetDataDimension()); // NTU
- filenameBlock=filename+"/mhdb-"+ std::to_string(i)+"-"+ std::to_string(j)+"-"+ std::to_string(k)+".mhd";
w->SetFileName( filenameBlock.c_str() );
w->Write();
w->Delete();
+
+ filenameBlockVti=filenameBlock+"-ZLib.vti";
+ vtkXMLImageDataWriter *writer = vtkXMLImageDataWriter::New();
+ writer->SetDataModeToBinary();
+ writer->SetCompressionLevel(5);
+ writer->SetCompressorTypeToZLib();
+ writer->SetFileName( filenameBlockVti.c_str() );
+ writer->SetInputData( bbGetInputIn() );
+ writer->Write();
+
+
extract->Delete();
} // for k
} // for j