]> Creatis software - creaImageIO.git/blob - bbtk/src/bbcreaImageIOGimmick.xml
#3188 creaImageIO Bug New Normal - DICOM tags
[creaImageIO.git] / bbtk / src / bbcreaImageIOGimmick.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!--==========================================================================
3    STARTS THE DESCRIPTION OF THE BLACK BOX -->
4 <blackbox name="Gimmick">
5  <!--========================================================================
6     THE BOX DOCUMENTATION -->
7   <author>laurent.guigues@creatis.insa-lyon.fr</author>
8   <description>Gimmick! (Gimme my medical images quick!) is a medical image reader widget. It handles DICOM,jpg,tif,png,bmp and mhd. Images read are stored in sqlite3 databases and thus retrieved very quick next time. Screenshot : <img src=Gimmick1.jpg></img>"</description>
9   <category>image;reader;dicom</category>
10
11 <!--========================================================================
12     #include directives to be put in the .h generated
13     There must be one tag per file to include -->
14 <include>creaImageIOWxGimmickReaderDialog.h</include>
15  <!--========================================================================
16     INPUTS/OUTPUTS DECLARATION -->
17
18   <input name="Title"                type="std::string" description="Title of the dialog"/>
19   <input name="ImageMinDimension"    type="int"         description="The minimal dimensionality of the image to be selected, e.g. 2 for a 2D image, 3 for a 3D image,..."/>
20   <input name="ImageMaxDimension"    type="int"         description="The maximal dimensionality of the image to be selected, e.g. 2 for a 2D image, 3 for a 3D image,..."/>
21   <input name="ImageOutputDimension" type="int"         description="The dimensionality of the output image, e.g. 2 for a 2D image, 3 for a 3D image,..."/>
22   <input name="Output"               type="int"         description="What to output ? 0(default)=image and filenames/1=only filenames"/>
23
24   <typedef>
25     <PRE>
26       typedef std::vector<std::string> VectorStringType;</PRE>
27   </typedef>
28   <input name="DicomTags" type="VectorStringType" description="Dicom Tags (vector of Dicom tags ex: D0028_0030  D0020_0037)"/>
29
30
31   <typedef>
32     <PRE>
33       typedef std::map<std::string, std::string> MapInfoDicom;</PRE>
34   </typedef>
35
36   <typedef>
37     <PRE>
38       typedef std::vector< MapInfoDicom > VectorMapInfoDicom;</PRE>
39   </typedef>
40   <output name="DicomInfo" type="VectorMapInfoDicom" description="vector of maps of Dicom tags"/>
41
42
43   <typedef><PRE>typedef std::vector<std::string>   OutputFilesType; </PRE></typedef>
44   <typedef><PRE>typedef std::vector<vtkImageData*> OutputImagesType;</PRE></typedef>
45
46  <output name="Out"   type="vtkImageData*"    description="The first selected image"/>
47  <output name="Out2"  type="OutputImagesType" description="The selected images"/>
48  <output name="Files" type="OutputFilesType"  description="The selected files"/>
49  
50  <!--========================================================================
51     PROCESS section -->
52
53   <process><PRE>
54    int threads = 1;
55
56    creaImageIO::WxGimmickReaderDialog w(0,
57                                   -1,
58                                 "localdatabase_Descriptor.dscp", 
59                                 "Local Database",
60                                   crea::std2wx(bbGetInputTitle()),
61                                   wxDefaultPosition,
62                                   wxSize(1200,800),
63                                   bbGetInputImageMinDimension(),
64                                   bbGetInputImageMaxDimension(),
65                                   bbGetInputImageOutputDimension(),
66                                   threads);
67    w.ShowModal();
68 /*     
69    if (w.GetReturnCode() == wxID_OK)
70      {
71        if (bbGetInputOutput()==0) 
72          {
73            std::vector<vtkImageData*> images;
74            w.GetSelectedImages(images,bbGetInputImageOutputDimension());
75            bbSetOutputOut(images[0]);
76            bbSetOutputOut2(images);
77          }
78        std::vector<std::string> files;
79        w.GetSelectedFiles(files);
80        bbSetOutputFiles(files);
81      }   
82    else if (w.GetReturnCode() == wxID_CANCEL)
83      {
84 //    if (bbGetOutputOut()!=0) 
85 //     { 
86 //       bbGetOutputOut()->Delete();
87 //          bbSetOutputOut(0);
88 //     }
89      }
90 */
91
92
93
94                 /// vtkImageData vector
95                 std::vector<vtkImageData*>                                                      m_results;
96                 std::vector< std::map<std::string,std::string> >        m_resultsDicomAtr;
97
98
99                  if (w.GetReturnCode() == wxID_OK)
100              {
101                         w.stopReading();
102                         std::vector<creaImageIO::OutStrGimmick> outStrGimmick;
103                         w.getSelected(outStrGimmick, bbGetInputDicomTags() ,true,"");
104                         m_results.clear();
105                         int size=(int)outStrGimmick.size();
106                         int ii;
107 //                      if(!bInfo)
108 //                      {
109                                 for (ii=0;ii<size;ii++)
110                                 {
111                                         outStrGimmick[ii].img->Modified();
112                                         outStrGimmick[ii].img->Update();
113                                         m_results.push_back(outStrGimmick[ii].img);
114                                         m_resultsDicomAtr.push_back( outStrGimmick[ii].infos );
115                                 }
116 //                      } else {
117 //                              for (ii=0;ii<size;ii++)
118 //                              {
119 //                                      m_resultsInfo.push_back(outStrGimmick[ii]);
120 //                              }
121 //                      }
122
123 //                      infoimage               =       _T("EED Missing info <void> ???");
124 //                      infoimageSource =       _T("GIMMICK");
125
126        if (bbGetInputOutput()==0) 
127          {
128 //           std::vector<vtkImageData*> images;
129 //           w.GetSelectedImages(images,bbGetInputImageOutputDimension());
130            bbSetOutputOut(m_results[0]);
131            bbSetOutputOut2(m_results);
132          }
133        std::vector<std::string> files;
134        w.GetSelectedFiles(files);
135        bbSetOutputFiles(files);
136
137
138         bbSetOutputDicomInfo( m_resultsDicomAtr );
139
140
141
142                         w.OnExit();
143                  }
144
145
146
147
148   </PRE></process>
149
150
151
152     <!--========================================================================
153     CONSTRUCTORS / DESTRUCTORS (OPTIONAL) -->
154   <defaultValues><PRE> 
155     bbSetInputImageMinDimension(2);
156     bbSetInputImageMaxDimension(3);
157     bbSetInputImageOutputDimension(3);
158     bbSetInputTitle("Select image(s)");
159     bbSetInputOutput(0);
160         bbSetOutputOut(0);
161
162   </PRE></defaultValues>    
163   
164   <initializeProcessing><PRE>
165   </PRE></initializeProcessing>    
166   
167   <finalizeProcessing><PRE>
168     std::vector<vtkImageData*>::iterator i;
169     for (i=bbGetOutputOut2().begin();i!=bbGetOutputOut2().end();++i) (*i)->Delete();
170   </PRE></finalizeProcessing>    
171   <!--=====================================================================-->
172
173
174
175 </blackbox>
176