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);
29 template <class TImage>
30 void ItkImagesChooserDialogBox::Export()
32 if (dlg->getImagesSelected().size() == 1)
34 bbSetOutputOut( dlg->getTemplatedImagesSelected<TImage>().front().GetPointer() );
36 else if (dlg->getImagesSelected().size() > 1)
38 OutputImagesITKType outVect;
40 typename std::vector<typename TImage::Pointer> tempImgs= dlg->getTemplatedImagesSelected<TImage>();
41 typename std::vector<typename TImage::Pointer>::iterator it = tempImgs.begin();
42 for(;it != tempImgs.end(); ++it)
44 outVect.push_back( (*it).GetPointer() );
46 bbSetOutputOutIImages( outVect);
50 // warning: passing NULL to non-pointer
51 //bbSetOutputOut( NULL);
52 bbSetOutputOut(0); // JPR
54 // FCY To test the Output
55 //typedef itk::Image <short, 3> ImageType;
56 //typedef itk::ImageFileReader< ImageType > itkReaderType;
57 // typename itkReaderType::Pointer reader = itkReaderType::New();
59 // reader->SetFileName("d:\test.hdr");
61 //reader->GetOutput()->Register();
62 // this->bbSetOutputOut(reader->GetOutput());
64 template <class TImage>
65 void ItkImagesChooserDialogBox::ExportVTK()
67 // BBTK can support only a vector with same dimensions image.
68 if (dlg->getDims().front() < 4)
70 typename std::vector<typename TImage::Pointer> tempImgs= dlg->getTemplatedImagesSelected<TImage>();
71 typename std::vector<typename TImage::Pointer>::iterator it = tempImgs.begin();
72 for(;it != tempImgs.end(); ++it)
74 dlg->split3Din3Dvtk<TImage>( (*it) );
76 bbSetOutputOutVImages( dlg->getVtkImagesSelected() );
78 else if (dlg->getDims().front() == 4)
81 // dlg->split4Din3Dvtk("d:/temp2");
82 // bbSetOutputOutVImages( dlg->getVtkImagesSelected());
86 // NOT IMPLEMENTED YET FOR DIMENSIONS > 4
92 // 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)
94 void ItkImagesChooserDialogBox::bbUserSetDefaultValues()
99 // 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)
101 void ItkImagesChooserDialogBox::bbUserInitializeProcessing()
106 // 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)
108 void ItkImagesChooserDialogBox::bbUserFinalizeProcessing()
113 // EO namespace bbcreaImageIO