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)
5 #include "bbcreaImageIOItkImagesChooserDialogBox.h"
6 #include "bbcreaImageIOPackage.h"
8 namespace bbcreaImageIO
11 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaImageIO,ItkImagesChooserDialogBox)
12 BBTK_BLACK_BOX_IMPLEMENTATION(ItkImagesChooserDialogBox,bbtk::AtomicBlackBox);
14 // 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)
16 void ItkImagesChooserDialogBox::Process()
19 dlg = new creaImageIO::WxAnySimpleDlg(0,crea::std2wx(bbGetInputTitle()),"localdatabase_Descriptor.dscp","Local Database");
22 bbtk::TypeInfo typ = bbitk::GetITKImagePtrTypeInfoFromPixelTypeInfoAndDimension(*dlg->getTypes().front(), dlg->getDims().front());
23 BBTK_TEMPLATE_ITK_IMAGE_SWITCH(typ, Export);
24 BBTK_TEMPLATE_ITK_IMAGE_SWITCH(typ, ExportVTK);
28 template <class TImage>
29 void ItkImagesChooserDialogBox::Export()
31 if (dlg->getImagesSelected().size() == 1)
33 bbSetOutputOut( dlg->getTemplatedImagesSelected<TImage>().front().GetPointer() );
35 else if (dlg->getImagesSelected().size() > 1)
37 OutputImagesITKType outVect;
38 std::vector<TImage::Pointer> tempImgs= dlg->getTemplatedImagesSelected<TImage>();
39 std::vector<TImage::Pointer>::iterator it = tempImgs.begin();
40 for(;it != tempImgs.end(); ++it)
42 outVect.push_back( (*it).GetPointer() );
44 bbSetOutputOutIImages( outVect);
48 bbSetOutputOut( NULL);
50 // FCY To test the Output
51 //typedef itk::Image <short, 3> ImageType;
52 //typedef itk::ImageFileReader< ImageType > itkReaderType;
53 // typename itkReaderType::Pointer reader = itkReaderType::New();
55 // reader->SetFileName("d:\test.hdr");
57 //reader->GetOutput()->Register();
58 // this->bbSetOutputOut(reader->GetOutput());
60 template <class TImage>
61 void ItkImagesChooserDialogBox::ExportVTK()
63 // BBTK can support only a vector with same dimensions image.
64 if (dlg->getDims().front() < 4)
66 std::vector<TImage::Pointer> tempImgs= dlg->getTemplatedImagesSelected<TImage>();
67 std::vector<TImage::Pointer>::iterator it = tempImgs.begin();
68 for(;it != tempImgs.end(); ++it)
70 dlg->split3Din3Dvtk<TImage>( (*it) );
72 bbSetOutputOutVImages( dlg->getVtkImagesSelected() );
74 else if (dlg->getDims().front() == 4)
77 // dlg->split4Din3Dvtk("d:/temp2");
78 // bbSetOutputOutVImages( dlg->getVtkImagesSelected());
82 // NOT IMPLEMENTED YET FOR DIMENSIONS > 4
88 // 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)
90 void ItkImagesChooserDialogBox::bbUserSetDefaultValues()
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 ItkImagesChooserDialogBox::bbUserInitializeProcessing()
104 // 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)
106 void ItkImagesChooserDialogBox::bbUserFinalizeProcessing()
111 // EO namespace bbcreaImageIO