2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
28 // 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)
31 #include "bbcreaImageIOItkImagesChooserDialogBox.h"
32 #include "bbcreaImageIOPackage.h"
34 namespace bbcreaImageIO
37 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaImageIO,ItkImagesChooserDialogBox)
38 BBTK_BLACK_BOX_IMPLEMENTATION(ItkImagesChooserDialogBox,bbtk::AtomicBlackBox);
40 // 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)
42 void ItkImagesChooserDialogBox::Process()
45 dlg = new creaImageIO::WxAnySimpleDlg(0,crea::std2wx(bbGetInputTitle()),"localdatabase_Descriptor.dscp","Local Database");
48 bbtk::TypeInfo typ = bbitk::GetITKImagePtrTypeInfoFromPixelTypeInfoAndDimension(*dlg->getTypes().front(), dlg->getDims().front());
49 BBTK_TEMPLATE_ITK_IMAGE_SWITCH(typ, Export);
50 BBTK_TEMPLATE_ITK_IMAGE_SWITCH(typ, ExportVTK);
55 template <class TImage>
56 void ItkImagesChooserDialogBox::Export()
58 if (dlg->getImagesSelected().size() == 1)
60 bbSetOutputOut( dlg->getTemplatedImagesSelected<TImage>().front().GetPointer() );
62 else if (dlg->getImagesSelected().size() > 1)
64 OutputImagesITKType outVect;
66 typename std::vector<typename TImage::Pointer> tempImgs= dlg->getTemplatedImagesSelected<TImage>();
67 typename std::vector<typename TImage::Pointer>::iterator it = tempImgs.begin();
68 for(;it != tempImgs.end(); ++it)
70 outVect.push_back( (*it).GetPointer() );
72 bbSetOutputOutIImages( outVect);
76 // warning: passing NULL to non-pointer
77 //bbSetOutputOut( NULL);
78 bbSetOutputOut(0); // JPR
80 // FCY To test the Output
81 //typedef itk::Image <short, 3> ImageType;
82 //typedef itk::ImageFileReader< ImageType > itkReaderType;
83 // typename itkReaderType::Pointer reader = itkReaderType::New();
85 // reader->SetFileName("d:\test.hdr");
87 //reader->GetOutput()->Register();
88 // this->bbSetOutputOut(reader->GetOutput());
90 template <class TImage>
91 void ItkImagesChooserDialogBox::ExportVTK()
93 // BBTK can support only a vector with same dimensions image.
94 if (dlg->getDims().front() < 4)
96 typename std::vector<typename TImage::Pointer> tempImgs= dlg->getTemplatedImagesSelected<TImage>();
97 typename std::vector<typename TImage::Pointer>::iterator it = tempImgs.begin();
98 for(;it != tempImgs.end(); ++it)
100 dlg->split3Din3Dvtk<TImage>( (*it) );
102 bbSetOutputOutVImages( dlg->getVtkImagesSelected() );
104 else if (dlg->getDims().front() == 4)
107 // dlg->split4Din3Dvtk("d:/temp2");
108 // bbSetOutputOutVImages( dlg->getVtkImagesSelected());
112 // NOT IMPLEMENTED YET FOR DIMENSIONS > 4
118 // 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)
120 void ItkImagesChooserDialogBox::bbUserSetDefaultValues()
125 // 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)
127 void ItkImagesChooserDialogBox::bbUserInitializeProcessing()
132 // 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)
134 void ItkImagesChooserDialogBox::bbUserFinalizeProcessing()
139 // EO namespace bbcreaImageIO