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;
35 std::vector<vtkImageData*> lstImages;
37 if ( bbGetInputFileNames().size()>0 )
39 if (bbGetInputType()==0)
41 vtkNIFTIImageReader* reader=vtkNIFTIImageReader::New();
42 if ( bbGetInputFileNames().size()==1)
44 reader->SetFileName( bbGetInputFileNames()[0].c_str() );
47 vtkStringArray *lstFileNames=vtkStringArray::New();
48 int i,size=bbGetInputFileNames().size();
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() );
71 if (lstImages.size()>=1) { bbSetOutputOut( lstImages[0] ); } else {bbSetOutputOut( NULL ); }
72 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()
80 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
81 // Here we initialize the input 'In' to 0
86 // 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)
88 void NIFTIImageReader::bbUserInitializeProcessing()
90 // THE INITIALIZATION METHOD BODY :
92 // but this is where you should allocate the internal/output pointers
97 // 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)
99 void NIFTIImageReader::bbUserFinalizeProcessing()
101 // THE FINALIZATION METHOD BODY :
103 // but this is where you should desallocate the internal/output pointers
107 }// EO namespace bbcreaVtk