]> Creatis software - creaImageIO.git/blob - appli/TestWxItkView/main.cxx
Bug #1776 Compilation error src/creaImageIOSimpleView.h
[creaImageIO.git] / appli / TestWxItkView / main.cxx
1 /*
2         # ---------------------------------------------------------------------
3         #
4         # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
5         #                        pour la Santé)
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
9         #
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.
16         #
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
21         #  liability. 
22         #
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         # ------------------------------------------------------------------------
26 */
27 #include <creaImageIOSystem.h>
28 #include <creaWx.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>
35
36
37 #define ITK_DIM_TO_TEST 3
38
39 // Just to test the selection of file(s), directory or from creaImageIO database.
40 class myApp : public wxApp
41 {
42 public:
43   bool OnInit( );
44   int  OnExit() { return true; }
45 };
46
47 IMPLEMENT_APP(myApp);
48
49 CREA_WXMAIN_WITH_CONSOLE
50
51 bool myApp::OnInit( )
52 {
53   wxApp::OnInit();
54 #ifdef __WXGTK__
55   //See http://www.wxwindows.org/faqgtk.htm#locale
56   setlocale(LC_NUMERIC, "C");
57 #endif
58    wxInitAllImageHandlers();
59
60         typedef itk::Image<short, ITK_DIM_TO_TEST >  ImageType2;
61    // Test for Juan Carlos
62         creaImageIO::SimpleReaderItkVtk<ImageType2> y;
63         
64         std::vector <vtkImageData*> vtest = y.readDirectoryinVTK("D:\\data-images\\Analyze7.5\\1_15_ep2d_diff_30dir_20061218");
65 y.getFilesinITK();
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81    std::vector <vtkImageData*> vtktest;
82    std::vector<std::string> exts;
83    vtkImageData* im = vtkImageData::New();
84  
85                         creaImageIO::WxAnySimpleDlg w(0);
86                         w.ShowModal();
87                 //      std::vector <boost::any> Wtest = w.getImagesSelected();
88    
89  
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)(
96                                 
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)
103           {
104                 crea::VtkBasicSlicer(vtktest.front());
105           }
106    
107    
108    
109  //  if(ITK_DIM_TO_TEST == 3)
110  //  {
111  //  
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");
116  //      x.setExts(exts);
117  //      x.ShowModal();
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)
124         //  {
125         //      crea::VtkBasicSlicer(vtktest.front());
126         //  }
127  // }
128  // else if (ITK_DIM_TO_TEST == 4)
129  // {
130         //  typedef itk::Image<short, ITK_DIM_TO_TEST >  ImageType;
131  //     creaImageIO::WxISimpleDlg<ImageType> x(0);
132         //  x.ShowModal();
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)
140         //  {
141         //      crea::VtkBasicSlicer(vtktest.front());
142         //  }
143         //}
144  //  
145  // else{}
146
147  //
148   
149    return false;
150 }
151
152