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;
39 typename std::vector<typename TImage::Pointer> tempImgs= dlg->getTemplatedImagesSelected<TImage>();
40 typename std::vector<typename TImage::Pointer>::iterator it = tempImgs.begin();
41 for(;it != tempImgs.end(); ++it)
43 outVect.push_back( (*it).GetPointer() );
45 bbSetOutputOutIImages( outVect);
49 bbSetOutputOut( NULL);
51 // FCY To test the Output
52 //typedef itk::Image <short, 3> ImageType;
53 //typedef itk::ImageFileReader< ImageType > itkReaderType;
54 // typename itkReaderType::Pointer reader = itkReaderType::New();
56 // reader->SetFileName("d:\test.hdr");
58 //reader->GetOutput()->Register();
59 // this->bbSetOutputOut(reader->GetOutput());
61 template <class TImage>
62 void ItkImagesChooserDialogBox::ExportVTK()
64 // BBTK can support only a vector with same dimensions image.
65 if (dlg->getDims().front() < 4)
67 typename std::vector<typename TImage::Pointer> tempImgs= dlg->getTemplatedImagesSelected<TImage>();
68 typename std::vector<typename TImage::Pointer>::iterator it = tempImgs.begin();
69 for(;it != tempImgs.end(); ++it)
71 dlg->split3Din3Dvtk<TImage>( (*it) );
73 bbSetOutputOutVImages( dlg->getVtkImagesSelected() );
75 else if (dlg->getDims().front() == 4)
78 // dlg->split4Din3Dvtk("d:/temp2");
79 // bbSetOutputOutVImages( dlg->getVtkImagesSelected());
83 // NOT IMPLEMENTED YET FOR DIMENSIONS > 4
89 // 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)
91 void ItkImagesChooserDialogBox::bbUserSetDefaultValues()
98 // 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)
100 void ItkImagesChooserDialogBox::bbUserInitializeProcessing()
105 // 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)
107 void ItkImagesChooserDialogBox::bbUserFinalizeProcessing()
112 // EO namespace bbcreaImageIO