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 # ------------------------------------------------------------------------
27 #include <creaImageIOSystem.h>
29 //#include <creaImageIOWxISimpleDlg.h>
30 //#include <creaImageIOWxISimpleDlg.hpp>
31 #include <itkImageBase.h>
32 #include <creaVtkBasicSlicer.h>
33 #include <creaImageIOWxAnySimpleDlg.h>
34 #include <creaImageIOItkVtkImport.h>
37 #define ITK_DIM_TO_TEST 3
39 // Just to test the selection of file(s), directory or from creaImageIO database.
40 class myApp : public wxApp
44 int OnExit() { return true; }
49 CREA_WXMAIN_WITH_CONSOLE
55 //See http://www.wxwindows.org/faqgtk.htm#locale
56 setlocale(LC_NUMERIC, "C");
58 wxInitAllImageHandlers();
60 typedef itk::Image<short, ITK_DIM_TO_TEST > ImageType2;
61 // Test for Juan Carlos
62 creaImageIO::SimpleReaderItkVtk<ImageType2> y;
64 std::vector <vtkImageData*> vtest = y.readDirectoryinVTK("D:\\data-images\\Analyze7.5\\1_15_ep2d_diff_30dir_20061218");
81 std::vector <vtkImageData*> vtktest;
82 std::vector<std::string> exts;
83 vtkImageData* im = vtkImageData::New();
85 creaImageIO::WxAnySimpleDlg w(0);
87 // std::vector <boost::any> Wtest = w.getImagesSelected();
90 typedef itk::Image<float, ITK_DIM_TO_TEST > ImageType;
91 ImageType::Pointer img = ImageType::New();
92 // img = boost::any_cast<ImageType*>(Wtest[0]);
93 //int count = boost::unsafe_any_cast<ImageType*>(Wtest[0]).GetReferenceCount();
94 std::vector <ImageType::Pointer> test;
95 //test.push_back( (ImageType::Pointer)(
97 // w.getImage<ImageType>(Wtest.front());
98 test = w.getTemplatedImagesSelected<ImageType>();
99 w.split3Din3Dvtk<ImageType>(test.front());
100 w.split3Din3Dvtk<ImageType>(test.back());
101 vtktest = w.getVtkImagesSelected();
102 if(vtktest.size() >0)
104 crea::VtkBasicSlicer(vtktest.front());
109 // if(ITK_DIM_TO_TEST == 3)
112 // typedef itk::Image<short, ITK_DIM_TO_TEST > ImageType;
113 // creaImageIO::WxISimpleDlg<ImageType> x(0);
114 // // files extension to take in count
115 // exts.push_back(".hdr");
118 // // get itkImage vector
119 // std::vector <ImageType::Pointer> test = x.getImagesSelected();
120 // // convert 3D itk to 3D vtk
121 // x.split3Din3Dvtk();
122 // vtktest = x.getVtkImagesSelected();
123 // if(vtktest.size() >0)
125 // crea::VtkBasicSlicer(vtktest.front());
128 // else if (ITK_DIM_TO_TEST == 4)
130 // typedef itk::Image<short, ITK_DIM_TO_TEST > ImageType;
131 // creaImageIO::WxISimpleDlg<ImageType> x(0);
133 // // get itkImage vector
134 // std::vector <ImageType::Pointer> test = x.getImagesSelected();
135 // // convert 4D itk to 3D vtk with a directory to create tempory vtk files.
136 // x.split4Din3Dvtk("d:/temp2");
137 // // get vtkImageData* vector
138 // vtktest = x.getVtkImagesSelected();
139 // if(vtktest.size() >0)
141 // crea::VtkBasicSlicer(vtktest.front());