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 <creaImageIOWxGimmickReaderDialog.h>
30 #include "vtkMetaImageWriter.h"
31 #include "vtkMetaImageReader.h"
32 #include <creaVtkBasicSlicer.h>
37 //#pragma comment(lib, "creaImageIO.lib")
38 //#pragma comment(lib, "DelayImp.lib")
41 //// Tell the linker that my DLL should be delay loaded
42 ////#pragma comment(linker, "/DelayLoad:creaImageIO.Dll")
44 //// Tell the linker that I want to be able to unload my DLL
45 //#pragma comment(linker, "/Delay:unload")
48 class myApp : public wxApp
52 int OnExit() { return true; }
57 CREA_WXMAIN_WITH_CONSOLE
65 //See http://www.wxwindows.org/faqgtk.htm#locale
66 setlocale(LC_NUMERIC, "C");
68 wxInitAllImageHandlers();
70 creaImageIO::SetGimmickMessageLevel(5);
71 creaImageIO::SetGimmickDebugMessageLevel(0);
73 int min_dim = GIMMICK_2D_IMAGE_SELECTION;
74 int max_dim = GIMMICK_3D_IMAGE_SELECTION;
77 // int output_dim = NATIVE;
82 creaImageIO::WxGimmickReaderDialog w(
85 "localdatabase_Descriptor.dscp",
87 _T("Select image(s) - creaImageIOApp (c) CREATIS ( cnrs)"),
96 endwait = clock () + CLOCKS_PER_SEC ;
97 while (clock() < endwait ) {}*/
100 if (w.GetReturnCode() == wxID_OK)
102 std::cout << "$$$$ main : user clicked 'OK' $$$$"<<std::endl;
103 std::cout << "$$$$ selected files : "<<std::endl;
105 std::vector<std::string> s;
106 w.GetSelectedFiles(s);
107 std::vector<std::string>::iterator i;
108 for (i=s.begin();i!=s.end();++i)
110 std::cout << *i << std::endl;
112 std::cout << "$$$$ "<<std::endl;
115 /* std::vector<vtkImageData*> images;
116 w.GetSelectedImages(images,3);*/
120 // We take all attributes from database
121 // but only for the first selected file.
122 // For the moment, no output model file (XML)
123 // std::vector<creaImageIO::OutStrGimmick> out;
124 // std::vector<std::string> attr;
125 // attr.push_back("ALL");
126 // w.getSelected(out, attr, false,"");
130 // We take all attributes from database
131 // but for all selected file.
132 // For the moment, no output model file (XML)
133 // std::vector<creaImageIO::OutStrGimmick> out;
134 // std::vector<std::string> attr;
135 // attr.push_back("ALL");
136 // w.getSelected(out, attr,true,"");
139 // We take attributes from database and others
140 // but for all selected file.
141 // For the moment, no output model file (XML)
142 std::vector<creaImageIO::OutStrGimmick> out;
143 std::vector<std::string> outFileNames;
144 std::vector<std::string> attr;
145 attr.push_back("D0028_0010");
146 attr.push_back("D0008_0023");
147 attr.push_back("D0008_1070");
148 w.getSelected(out, attr,outFileNames,true,"");
149 std::cout<<out.size()<<std::endl;
150 crea::VtkBasicSlicer(out.front().img);
151 out.front().img->Delete();
155 // images[1]->UpdateInformation();
156 /* vtkMetaImageReader *r= vtkMetaImageReader::New();
157 r->SetFileName("c:\\toto.mhd");
159 images[0]->GetSpacing(zz);
161 vtkMetaImageWriter* ww = vtkMetaImageWriter::New();
162 ww->SetFileName("c:\\toto2.mhd");
163 ww->SetInput(images[0]);
164 ww->GetInput()->ShallowCopy(images[0]);
165 ww->UpdateInformation();
166 ww->GetInput()->GetSpacing(zz);
169 //>GetImageDataInput(0)->GetSpacing(zz);
179 //crea::VtkBasicSlicer(out.front().img);
180 // images.front()->Delete();
184 else if (w.GetReturnCode() == wxID_CANCEL)
188 std::cout << "$$$$ main : user clicked 'CANCEL' $$$$"<<std::endl;
193 std::cout << "$$$$ main : dialog ended without return code ! $$$$"
198 // std::cout << "$$$$ main : deleting dialog"<<std::endl;
200 std::cout << "$$$$$$$$$$$$$$$$$$$$ main ended "<<std::endl;