2 // 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)
4 #include "bbcreaVtkNIFTIImageReader.h"
5 #include "bbcreaVtkPackage.h"
7 #include <vtkNIFTIImageReader.h>
8 #include <vtkStringArray.h>
13 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,NIFTIImageReader)
14 BBTK_BLACK_BOX_IMPLEMENTATION(NIFTIImageReader,bbtk::AtomicBlackBox);
16 // 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)
18 void NIFTIImageReader::Process()
21 // THE MAIN PROCESSING METHOD BODY
22 // Here we simply set the input 'In' value to the output 'Out'
23 // And print out the output value
24 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
25 // void bbSet{Input|Output}NAME(const TYPE&)
26 // const TYPE& bbGet{Input|Output}NAME() const
28 // * NAME is the name of the input/output
29 // (the one provided in the attribute 'name' of the tag 'input')
30 // * TYPE is the C++ type of the input/output
31 // (the one provided in the attribute 'type' of the tag 'input')
32 // bbSetOutputOut( bbGetInputIn() );
33 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
36 std::vector<vtkImageData*> lstImages;
38 if (bbGetInputType()==0)
40 vtkNIFTIImageReader* reader=vtkNIFTIImageReader::New();
41 if ( bbGetInputFileNames().size()==1)
43 reader->SetFileName( bbGetInputFileNames()[0].c_str() );
46 vtkStringArray *lstFileNames=vtkStringArray::New();
47 int i,size=bbGetInputFileNames().size();
50 printf("EED Warnning, somethin is not working ???? NIFTIImageReader::Process() %s\n ", bbGetInputFileNames()[i].c_str() );
51 lstFileNames->InsertNextValue( bbGetInputFileNames()[i].c_str() );
53 reader->SetFileNames( lstFileNames );
56 lstImages.push_back( reader->GetOutput() );
59 if (bbGetInputType()==1)
61 int i,size=bbGetInputFileNames().size();
64 vtkNIFTIImageReader* reader=vtkNIFTIImageReader::New();
65 reader->SetFileName( bbGetInputFileNames()[i].c_str() );
67 lstImages.push_back( reader->GetOutput() );
72 if (lstImages.size()>=1) { bbSetOutputOut( lstImages[0] ); } else {bbSetOutputOut( NULL ); }
73 bbSetOutputOutVector( lstImages );
76 // 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)
78 void NIFTIImageReader::bbUserSetDefaultValues()
81 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
82 // Here we initialize the input 'In' to 0
87 // 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)
89 void NIFTIImageReader::bbUserInitializeProcessing()
92 // THE INITIALIZATION METHOD BODY :
94 // but this is where you should allocate the internal/output pointers
100 // 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)
102 void NIFTIImageReader::bbUserFinalizeProcessing()
105 // THE FINALIZATION METHOD BODY :
107 // but this is where you should desallocate the internal/output pointers
112 // EO namespace bbcreaVtk