1 #include <creaImageIOSystem.h>
3 #include <creaImageIOWxGimmickReaderDialog.h>
4 #include "vtkMetaImageWriter.h"
5 #include "vtkMetaImageReader.h"
6 #include <creaVtkBasicSlicer.h>
10 //#pragma comment(lib, "creaImageIO.lib")
11 //#pragma comment(lib, "DelayImp.lib")
14 //// Tell the linker that my DLL should be delay loaded
15 ////#pragma comment(linker, "/DelayLoad:creaImageIO.Dll")
17 //// Tell the linker that I want to be able to unload my DLL
18 //#pragma comment(linker, "/Delay:unload")
21 class myApp : public wxApp
25 int OnExit() { return true; }
30 CREA_WXMAIN_WITH_CONSOLE
36 //See http://www.wxwindows.org/faqgtk.htm#locale
37 setlocale(LC_NUMERIC, "C");
39 wxInitAllImageHandlers();
41 creaImageIO::SetGimmickMessageLevel(5);
42 creaImageIO::SetGimmickDebugMessageLevel(0);
44 int min_dim = GIMMICK_2D_IMAGE_SELECTION;
45 int max_dim = GIMMICK_3D_IMAGE_SELECTION;
48 // int output_dim = NATIVE;
53 creaImageIO::WxGimmickReaderDialog w(
56 "localdatabase_Descriptor.dscp",
58 _T("Select image(s) - DCMAPI (c) VPH NOE ( cnrs - upf)"),
67 endwait = clock () + CLOCKS_PER_SEC ;
68 while (clock() < endwait ) {}*/
71 if (w.GetReturnCode() == wxID_OK)
73 std::cout << "$$$$ main : user clicked 'OK' $$$$"<<std::endl;
74 std::cout << "$$$$ selected files : "<<std::endl;
76 std::vector<std::string> s;
77 w.GetSelectedFiles(s);
78 std::vector<std::string>::iterator i;
79 for (i=s.begin();i!=s.end();++i)
81 std::cout << *i << std::endl;
83 std::cout << "$$$$ "<<std::endl;
86 std::vector<vtkImageData*> images;
87 w.GetSelectedImages(images,3);
91 // We take all attributes from database
92 // but only for the first selected file.
93 // For the moment, no output model file (XML)
94 // std::vector<creaImageIO::OutStrGimmick> out;
95 // std::vector<std::string> attr;
96 // attr.push_back("ALL");
97 // w.getSelected(out, attr, false,"");
101 // We take all attributes from database
102 // but for all selected file.
103 // For the moment, no output model file (XML)
104 // std::vector<creaImageIO::OutStrGimmick> out;
105 // std::vector<std::string> attr;
106 // attr.push_back("ALL");
107 // w.getSelected(out, attr,true,"");
110 // We take attributes from database and others
111 // but for all selected file.
112 // For the moment, no output model file (XML)
113 std::vector<creaImageIO::OutStrGimmick> out;
114 std::vector<std::string> attr;
115 attr.push_back("D0028_0010");
116 attr.push_back("D0008_0023");
117 attr.push_back("D0008_1070");
118 w.getSelected(out, attr,true,"");
119 std::cout<<out.size()<<std::endl;
120 crea::VtkBasicSlicer(out.front().img);
121 out.front().img->Delete();
125 // images[1]->UpdateInformation();
126 /* vtkMetaImageReader *r= vtkMetaImageReader::New();
127 r->SetFileName("c:\\toto.mhd");
129 images[0]->GetSpacing(zz);
131 vtkMetaImageWriter* ww = vtkMetaImageWriter::New();
132 ww->SetFileName("c:\\toto2.mhd");
133 ww->SetInput(images[0]);
134 ww->GetInput()->ShallowCopy(images[0]);
135 ww->UpdateInformation();
136 ww->GetInput()->GetSpacing(zz);
139 //>GetImageDataInput(0)->GetSpacing(zz);
149 crea::VtkBasicSlicer(out.front().img);
150 images.front()->Delete();
154 else if (w.GetReturnCode() == wxID_CANCEL)
158 std::cout << "$$$$ main : user clicked 'CANCEL' $$$$"<<std::endl;
163 std::cout << "$$$$ main : dialog ended without return code ! $$$$"
168 // std::cout << "$$$$ main : deleting dialog"<<std::endl;
170 std::cout << "$$$$$$$$$$$$$$$$$$$$ main ended "<<std::endl;