]> Creatis software - creaImageIO.git/blob - bbtk/src/bbcreaImageIOItkImagesChooserDialogBox.cxx
2d466515a29406b57e089245a5ca17b0a44b414e
[creaImageIO.git] / bbtk / src / bbcreaImageIOItkImagesChooserDialogBox.cxx
1 //===== 
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)
3 //===== 
4
5 #include "bbcreaImageIOItkImagesChooserDialogBox.h"
6 #include "bbcreaImageIOPackage.h"
7
8 namespace bbcreaImageIO
9 {
10
11 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaImageIO,ItkImagesChooserDialogBox)
12 BBTK_BLACK_BOX_IMPLEMENTATION(ItkImagesChooserDialogBox,bbtk::AtomicBlackBox);
13 //===== 
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)
15 //===== 
16 void ItkImagesChooserDialogBox::Process()
17 {
18  
19         dlg = new creaImageIO::WxAnySimpleDlg(0,crea::std2wx(bbGetInputTitle()),"localdatabase_Descriptor.dscp","Local Database"); 
20     dlg->ShowModal(); 
21
22         bbtk::TypeInfo typ = bbitk::GetITKImagePtrTypeInfoFromPixelTypeInfoAndDimension(*dlg->getTypes().front(), dlg->getDims().front());
23         BBTK_TEMPLATE_ITK_IMAGE_SWITCH(typ, Export);
24         bbSetOutputOutVImages(dlg->getVtkImagesSelected());
25         delete dlg;
26 }
27 template <class TImage>
28 void ItkImagesChooserDialogBox::Export()
29 {
30          if (dlg->getImagesSelected().size() == 1)
31          { 
32                 bbSetOutputOut( dlg->getTemplatedImagesSelected<TImage>().front().GetPointer() ); 
33          } 
34           else if (dlg->getImagesSelected().size() > 1)
35           { 
36                   OutputImagesITKType temp;
37                   //std::vector<TImage*> temp;
38                   std::vector<TImage::Pointer>::iterator it = dlg->getTemplatedImagesSelected<TImage>().begin();
39                   for(;it != dlg->getTemplatedImagesSelected<TImage>().end(); ++it)
40                   {
41                           temp.push_back( (*it).GetPointer() );
42                   }
43                 bbSetOutputOutIImages( temp); 
44       } 
45           else
46           {
47                 bbSetOutputOut( NULL); 
48           }
49          // FCY To test the Output
50           //typedef itk::Image <short, 3> ImageType;
51          //typedef itk::ImageFileReader< ImageType > itkReaderType;
52      //  typename itkReaderType::Pointer reader = itkReaderType::New();
53      //
54      //  reader->SetFileName("d:\test.hdr");
55      //   reader->Update(); 
56          //reader->GetOutput()->Register();
57      //  this->bbSetOutputOut(reader->GetOutput());
58 }
59 //===== 
60 // 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)
61 //===== 
62 void ItkImagesChooserDialogBox::bbUserSetDefaultValues()
63 {
64  
65  
66   
67 }
68 //===== 
69 // 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)
70 //===== 
71 void ItkImagesChooserDialogBox::bbUserInitializeProcessing()
72 {
73
74 }
75 //===== 
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)
77 //===== 
78 void ItkImagesChooserDialogBox::bbUserFinalizeProcessing()
79 {
80
81 }
82 }
83 // EO namespace bbcreaImageIO
84
85