]> Creatis software - creaImageIO.git/blobdiff - bbtk/src/bbcreaImageIOGimmick.xml
#3185 creaImageIO Feature New Normal - Clean code
[creaImageIO.git] / bbtk / src / bbcreaImageIOGimmick.xml
index 574bad166793466cddac59fc11bdebe1462096bf..d07a54fd2fc7ece26831afa24978bafc054d210e 100644 (file)
@@ -5,19 +5,47 @@
  <!--========================================================================
     THE BOX DOCUMENTATION -->
   <author>laurent.guigues@creatis.insa-lyon.fr</author>
-  <description>Gimmick! (Gimme my medical images quick!) is a ...</description>
+  <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>
   <category>image;reader;dicom</category>
 
 <!--========================================================================
     #include directives to be put in the .h generated
     There must be one tag per file to include -->
-<include>creaImageIOWxGimmickDialog.h</include>
+<include>creaImageIOWxGimmickReaderDialog.h</include>
  <!--========================================================================
     INPUTS/OUTPUTS DECLARATION -->
 
-  <input name="Title" type="std::string" description="Title of the dialog"/>
-  <input name="ImageDimension" type="int" description="The maximal dimensionality of the image to be selected, e.g. 2 for a 2D image, 3 for a 3D image,..."/>
- <output name="Out", type="vtkImageData*" description="The selected image"/>
+  <input name="Title"                type="std::string" description="Title of the dialog"/>
+  <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,..."/>
+  <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,..."/>
+  <input name="ImageOutputDimension" type="int"         description="The dimensionality of the output image, e.g. 2 for a 2D image, 3 for a 3D image,..."/>
+  <input name="Output"               type="int"         description="What to output ? 0(default)=image and filenames/1=only filenames"/>
+
+  <typedef>
+    <PRE>
+      typedef std::vector<std::string> VectorStringType;</PRE>
+  </typedef>
+  <input name="DicomTags" type="VectorStringType" description="Dicom Tags (vector of Dicom tags ex: D0028_0030  D0020_0037)"/>
+
+
+  <typedef>
+    <PRE>
+      typedef std::map<std::string, std::string> MapInfoDicom;</PRE>
+  </typedef>
+
+  <typedef>
+    <PRE>
+      typedef std::vector< MapInfoDicom > VectorMapInfoDicom;</PRE>
+  </typedef>
+  <output name="DicomInfo" type="VectorMapInfoDicom" description="vector of maps of Dicom tags"/>
+
+
+  <typedef><PRE>typedef std::vector<std::string>   OutputFilesType; </PRE></typedef>
+  <typedef><PRE>typedef std::vector<vtkImageData*> OutputImagesType;</PRE></typedef>
+
+ <output name="Out"   type="vtkImageData*"    description="The first selected image"/>
+ <output name="Out2"  type="OutputImagesType" description="The selected images"/>
+ <output name="Files" type="OutputFilesType"  description="The selected files"/>
  
  <!--========================================================================
     PROCESS section -->
   <process><PRE>
    int threads = 1;
 
-   creaImageIO::WxGimmickDialog w(0,
+   creaImageIO::WxGimmickReaderDialog w(0,
                                   -1,
+                               "localdatabase_Descriptor.dscp", 
+                               "Local Database",
                                   crea::std2wx(bbGetInputTitle()),
                                   wxDefaultPosition,
                                   wxSize(1200,800),
-                                  bbGetInputImageDimension(),
+                                  bbGetInputImageMinDimension(),
+                                  bbGetInputImageMaxDimension(),
+                                  bbGetInputImageOutputDimension(),
                                   threads);
    w.ShowModal();
-   
+/*     
    if (w.GetReturnCode() == wxID_OK)
      {
-       std::vector<vtkImageData*> images;
-       w.GetSelectedImages(images);
-       bbSetOutputOut(images[0]);
-     }
+       if (bbGetInputOutput()==0) 
+         {
+           std::vector<vtkImageData*> images;
+           w.GetSelectedImages(images,bbGetInputImageOutputDimension());
+           bbSetOutputOut(images[0]);
+           bbSetOutputOut2(images);
+         }
+       std::vector<std::string> files;
+       w.GetSelectedFiles(files);
+       bbSetOutputFiles(files);
+     }   
    else if (w.GetReturnCode() == wxID_CANCEL)
      {
 //    if (bbGetOutputOut()!=0) 
 //     { 
- //       bbGetOutputOut()->Delete();    
+//       bbGetOutputOut()->Delete();
 //          bbSetOutputOut(0);
-// }
+//     }
      }
+*/
+
+
+
+               /// vtkImageData vector
+               std::vector<vtkImageData*>                                                      m_results;
+               std::vector< std::map<std::string,std::string> >        m_resultsDicomAtr;
+
+
+                if (w.GetReturnCode() == wxID_OK)
+            {
+                       w.stopReading();
+                       std::vector<creaImageIO::OutStrGimmick> outStrGimmick;
+                       w.getSelected(outStrGimmick, bbGetInputDicomTags() ,true,"");
+                       m_results.clear();
+                       int size=(int)outStrGimmick.size();
+                       int ii;
+//                     if(!bInfo)
+//                     {
+                               for (ii=0;ii<size;ii++)
+                               {
+                                       outStrGimmick[ii].img->Modified();
+                                       outStrGimmick[ii].img->Update();
+                                       m_results.push_back(outStrGimmick[ii].img);
+                                       m_resultsDicomAtr.push_back( outStrGimmick[ii].infos );
+                               }
+//                     } else {
+//                             for (ii=0;ii<size;ii++)
+//                             {
+//                                     m_resultsInfo.push_back(outStrGimmick[ii]);
+//                             }
+//                     }
+
+//                     infoimage               =       _T("EED Missing info <void> ???");
+//                     infoimageSource =       _T("GIMMICK");
+
+       if (bbGetInputOutput()==0) 
+         {
+//           std::vector<vtkImageData*> images;
+//           w.GetSelectedImages(images,bbGetInputImageOutputDimension());
+           bbSetOutputOut(m_results[0]);
+           bbSetOutputOut2(m_results);
+         }
+       std::vector<std::string> files;
+               w.GetSelectedFiles(files);
+               bbSetOutputFiles(files);
+               bbSetOutputDicomInfo( m_resultsDicomAtr );
+               w.OnExit();
+                }
+
+
+
+
   </PRE></process>
 
- <!--======================================================================
-   CONSTRUCTORS / DESTRUCTORS (OPTIONAL) -->
 
-  <constructor><PRE> 
-    bbSetInputImageDimension(3);
+
+    <!--========================================================================
+    CONSTRUCTORS / DESTRUCTORS (OPTIONAL) -->
+  <defaultValues><PRE> 
+    bbSetInputImageMinDimension(2);
+    bbSetInputImageMaxDimension(3);
+    bbSetInputImageOutputDimension(3);
     bbSetInputTitle("Select image(s)");
-    bbSetOutputOut(0);
-  </PRE>
-  </constructor>
-
-
-  <!-- THE COPY-CONSTRUCTION METHOD BODY :
-    Here does nothing 
-    But this is where you should allocate the output pointers if any
-    and copy the pointed values (to avoid bug caused by multiple references) -->
-  <copyconstructor>
-  <PRE>
-    bbSetOutputOut(0);
-  </PRE>
-  </copyconstructor>
-
-  <!-- THE DESTRUCTION METHOD BODY :
-    Here does nothing 
-    but this is where you should desallocate the output pointers if any -->
-  <destructor>
-  <PRE>
-    if (bbGetOutputOut()!=0) bbGetOutputOut()->Delete();
-  </PRE>
-  </destructor>
+    bbSetInputOutput(0);
+       bbSetOutputOut(0);
+
+  </PRE></defaultValues>    
+  
+  <initializeProcessing><PRE>
+  </PRE></initializeProcessing>    
+  
+  <finalizeProcessing><PRE>
+    std::vector<vtkImageData*>::iterator i;
+    for (i=bbGetOutputOut2().begin();i!=bbGetOutputOut2().end();++i) (*i)->Delete();
+  </PRE></finalizeProcessing>    
+  <!--=====================================================================-->