--- /dev/null
+//=====
+// 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)
+//=====
+#include "bbcreaVtkWriteLstImages.h"
+#include "bbcreaVtkPackage.h"
+
+#include "vtkMetaImageWriter.h"
+#include <vtkNIFTIImageWriter.h>
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,WriteLstImages)
+BBTK_BLACK_BOX_IMPLEMENTATION(WriteLstImages,bbtk::AtomicBlackBox);
+//=====
+// 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 WriteLstImages::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+
+printf("EED WriteLstImages::Process Start\n");
+ vtkImageData *inImg;
+ std::string txtNum;
+ int i,size=bbGetInputLstImages().size();
+ for (i=0;i<size;i++)
+ {
+printf(" EED WriteLstImages::Process i=%d\n",i );
+
+ txtNum=std::to_string(i);
+ while (txtNum.length()<=5)
+ {
+ txtNum="0"+txtNum;
+ } // while
+
+ inImg=bbGetInputLstImages()[i];
+ if (bbGetInputType()==0) // mhd
+ {
+ vtkMetaImageWriter* w = vtkMetaImageWriter::New();
+ w->SetInputData( inImg );
+ w->SetCompression( bbGetInputCompression() );
+ w->SetFileDimensionality(inImg->GetDataDimension()); // NTU
+ std::string filename = bbGetInputOutputDir()+"/"+bbGetInputFileName()+"-"+txtNum+".mhd";
+ w->SetFileName(filename.c_str());
+ w->Write();
+ w->Delete();
+ } // Type
+
+ if (bbGetInputType()==1) // NIFTI
+ {
+ vtkNIFTIImageWriter* w = vtkNIFTIImageWriter::New();
+ w->SetInputData( inImg );
+ std::string filename = bbGetInputOutputDir()+"/"+bbGetInputFileName()+"-"+txtNum+".nii";
+ w->SetFileName(filename.c_str());
+ w->Write();
+ w->Delete();
+ } // Type
+
+
+
+ } // for i
+printf("EED WriteLstImages::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)
+//=====
+void WriteLstImages::bbUserSetDefaultValues()
+{
+
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+ bbSetInputType(0);
+ bbSetInputCompression(false);
+ bbSetInputFileName("void");
+ bbSetInputOutputDir(".");
+}
+//=====
+// 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 WriteLstImages::bbUserInitializeProcessing()
+{
+
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// 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 WriteLstImages::bbUserFinalizeProcessing()
+{
+
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+
+}
+}
+// EO namespace bbcreaVtk
+
+
--- /dev/null
+//=====
+// 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)
+//=====
+#ifndef __bbcreaVtkWriteLstImages_h_INCLUDED__
+#define __bbcreaVtkWriteLstImages_h_INCLUDED__
+
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+#include <vector>
+#include "vtkImageData.h"
+
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT WriteLstImages
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(WriteLstImages,bbtk::AtomicBlackBox);
+//=====
+// 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)
+//=====
+ BBTK_DECLARE_INPUT(Type,int);
+ BBTK_DECLARE_INPUT(OutputDir,std::string);
+ BBTK_DECLARE_INPUT(LstImages,std::vector< vtkImageData* >);
+ BBTK_DECLARE_INPUT(FileName,std::string);
+ BBTK_DECLARE_INPUT(Compression,bool);
+// BBTK_DECLARE_OUTPUT(Out,double);
+ BBTK_PROCESS(Process);
+ void Process();
+//=====
+// 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)
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(WriteLstImages,bbtk::AtomicBlackBox);
+ BBTK_NAME("WriteLstImages");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(WriteLstImages,Type,"(default 0) 0:mhd 1:nii",int,"");
+ BBTK_INPUT(WriteLstImages,OutputDir,"Output directory",std::string,"");
+ BBTK_INPUT(WriteLstImages,LstImages,"Lst of images",std::vector< vtkImageData* >,"");
+ BBTK_INPUT(WriteLstImages,FileName,"File name (no extension)",std::string,"");
+ BBTK_INPUT(WriteLstImages,Compression,"(Default false) true/false just for mhd",bool,"");
+
+// BBTK_OUTPUT(WriteLstImages,Out,"First output",double,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(WriteLstImages);
+//=====
+// 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)
+//=====
+}
+// EO namespace bbcreaVtk
+
+#endif // __bbcreaVtkWriteLstImages_h_INCLUDED__
+