]> Creatis software - creaImageIO.git/commitdiff
#3188 creaImageIO Bug New Normal - DICOM tags
authorEduardo DAVILA <davila@localhost.localdomain>
Tue, 17 Apr 2018 14:55:06 +0000 (16:55 +0200)
committerEduardo DAVILA <davila@localhost.localdomain>
Tue, 17 Apr 2018 14:55:06 +0000 (16:55 +0200)
bbtk/src/bbcreaImageIOGetDicomAttributesFromMaps.cxx
bbtk/src/bbcreaImageIOGimmick.xml
bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml
src/creaImageIOGimmick.cpp
src/creaImageIOSQLiteTreeHandler.cpp
src/creaImageIOWxGimmickReaderDialog.h
src/creaImageIOWxSimpleDlg.cpp
src/data/localdatabase_Descriptor.dscp

index 1dd7d1b2b359d38190d51ec92c26c7803b4fc4dd..98bdb5742217c7d01ccbd5210274da2c0be0786e 100644 (file)
@@ -13,7 +13,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(GetDicomAttributesFromMaps,bbtk::AtomicBlackBox);
 //===== 
 void GetDicomAttributesFromMaps::Process()
 {
-
 // THE MAIN PROCESSING METHOD BODY
 //   Here we simply set the input 'In' value to the output 'Out'
 //   And print out the output value
@@ -29,16 +28,22 @@ void GetDicomAttributesFromMaps::Process()
     std::vector< std::string > lstResult;
     std::map <std::string,std::string> tmpMap;
     int i,size=bbGetInputIn().size();
-    std::string strElement;
+
+// The MAP.find() function   is not working in all the cases
 
     for (i=0;i<size;i++)
     { 
                tmpMap = bbGetInputIn()[i];
-               strElement      = tmpMap.find( bbGetInputKeyDicom() )->second;
-               lstResult.push_back( strElement );
+               std::map<std::string, std::string>::iterator it;
+               for ( it = tmpMap.begin(); it != tmpMap.end(); it++ )
+               {
+                       if (it->first==bbGetInputKeyDicom())
+                       {
+                               lstResult.push_back( it->second );
+                       } // if it->first
+               }//for it
     } // for i
     bbSetOutputOut( lstResult );
-  
 }
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
index 8113d5c66fd6998b7ed4e15b9c74fc774ea1de8b..248a86840199d9e1d35906345202beb526640748 100644 (file)
   <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>
 
@@ -46,7 +65,7 @@
                                   bbGetInputImageOutputDimension(),
                                   threads);
    w.ShowModal();
-     
+/*     
    if (w.GetReturnCode() == wxID_OK)
      {
        if (bbGetInputOutput()==0) 
 //          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>
 
 
index 5f83018c43f159f903b4ba7ca5ba4ef112858596..6fd5d71c4a7fcb77b27bd3af94eecc21ce63311a 100644 (file)
   <process>
     <PRE>
         creaImageIO::WxSimpleDlg dlg(0,crea::std2wx(bbGetInputTitle()),"localdatabase_Descriptor.dscp","Local Database"); 
-                dlg.SetAttrDicomTags( bbGetInputDicomTags() );
-               dlg.ShowModal(); 
-                bbSetOutputDicomInfo( dlg.getDicomInfoImagesSelected() );
-               if (dlg.getImagesSelected().size()!=0)
-               { 
-                       bbSetOutputFileName( std::string( dlg.getInfoImage().mb_str() ) );
-                       bbSetOutputOut( dlg.getVolumeSelected() );
-
-               } else { 
-                       bbSetOutputOut( NULL );
-               } // if dlg.getImagesSelected().size()!=0
+        dlg.SetAttrDicomTags( bbGetInputDicomTags() );
+       dlg.ShowModal(); 
+       bbSetOutputDicomInfo( dlg.getDicomInfoImagesSelected() );
+       if (dlg.getImagesSelected().size()!=0)
+       { 
+               bbSetOutputFileName( std::string( dlg.getInfoImage().mb_str() ) );
+               bbSetOutputOut( dlg.getVolumeSelected() );
+       } else { 
+               bbSetOutputOut( NULL );
+       } // if dlg.getImagesSelected().size()!=0
         bbSetOutputOutImages( dlg.getImagesSelected());  
        bbSignalOutputModification(  );
-
     </PRE>
   </process>
 
index 6d296136060ffe020716d6b2c0ffbdd580d041b3..5b01f748f41d2b3f0ee747cccb7292c368806508 100644 (file)
@@ -560,11 +560,13 @@ void Gimmick::fillVectInfos(std::vector<std::string> i_attr, OutputAttr &infos)
        {
                if( mImageAdder.isAttributeExist((*it)) != "" ) // in DB
                {
+printf("EED Gimmick::fillVectInfos inside %s\n",(*it).c_str());
                        infos.inside.push_back((*it));
                }
                else
                {
                                infos.outside.push_back((*it)); // Need to scan again the files
+printf("EED Gimmick::fillVectInfos outside %s\n",(*it).c_str());
                }
        }
 }
@@ -580,4 +582,4 @@ const std::string Gimmick::getSummary()
     return mess.str();
 }
 
-}
\ No newline at end of file
+}
index 4a1e391c47a86c5a2ae6616d71fb14d923a4550e..e51bfa91ad9760cb0e3e8ce1246088f1bf8ffc21 100644 (file)
@@ -980,7 +980,7 @@ GimmickDebugMessage(1,                                      "query : '"                         <<query                                         <<std::endl);
   void SQLiteTreeHandler::getAllAttributes(std::string i_filename, std::map<std::string, std::string> &i_results)
   {
          int level=GetTree().GetNumberOfLevels()-1;
-         
+
          std::string search = i_filename;
          std::string param = "FullFileName";
          std::string name;
@@ -992,25 +992,27 @@ GimmickDebugMessage(1,                                    "query : '"                         <<query                                         <<std::endl);
          std::vector<std::string> values;
          std::vector<std::string>::iterator it_val;
         
-
-
-         
-         while(level>1)
+         while(level>=1)
          {
-                 attr = GetTree().GetAttributeDescriptorList(level,1);
+               attr = GetTree().GetAttributeDescriptorList(level,1);
 
-                 name = GetTree().GetLevelDescriptor(level).GetName();
-                 std::vector<std::string> values;
-                 GetUpLevelNodeId(level, param,search,id);
-                 GetAttributes(name, param,search,attr, values);
-                 for(it_attr = attr.begin(), it_val = values.begin(); it_attr != attr.end(); it_attr++, it_val++)
-                 {
-                                       i_results[(*it_attr).GetKey()] = (*it_val).c_str();
-                 }
-                 search = id;
-                 param = "ID";
-                 level --;
-         }
+               name = GetTree().GetLevelDescriptor(level).GetName();
+               std::vector<std::string> values;
+
+//EED 2018-04-13                 GetUpLevelNodeId(level, param,search,id);  
+               if (level>1)
+               {
+                       GetUpLevelNodeId(level, param,search,id);
+               }
+               GetAttributes(name, param,search,attr, values);
+               for(it_attr = attr.begin(), it_val = values.begin(); it_attr != attr.end(); it_attr++, it_val++)
+               {
+                       i_results[(*it_attr).GetKey()] = (*it_val).c_str();
+               } // for
+               search = id;
+               param = "ID";
+               level --;
+         } // while level
   }
 
 
@@ -1064,7 +1066,6 @@ GimmickDebugMessage(1,                                    "query : '"                         <<query                                         <<std::endl);
                q.nextRow();
          }
          parent_id = results.str();
-
   }
 
 
index 1f2a6c30808bd03005b340ce04e77df982252708..550322ca6d84d7e43119b8f9c7870cd5f51a03bf 100644 (file)
@@ -104,11 +104,11 @@ namespace creaImageIO
   private :
 
     boost::shared_ptr<Gimmick>   mGimmick;
-    WxGimmickViewmView;
+    WxGimmickView                              *mView;
 
-    wxButtonmOkButton;
-    wxButtonmCancelButton;
-       wxBoxSizer *mtopsizer;
+    wxButton                                   *mOkButton;
+    wxButton                                   *mCancelButton;
+       wxBoxSizer                                      *mtopsizer;
 
     enum 
       {
index 49a65a4b675779b92b1457fed506105235feb9d3..f11574cd070b50e066190ae7ef32f2b8b3bdf989 100644 (file)
@@ -135,7 +135,7 @@ namespace creaImageIO
                   WxGimmickReaderDialog dlg(0,-1, 
                                   namedescp,
                                   namedb, 
-                                  _T("Select image(s)        - Gimmick! (c) CREATIS-LRMN 2008"),
+                                  _T("Select image(s)        - Gimmick! (c)"),
                    wxDefaultPosition,
                    wxSize(810,750),
                    GIMMICK_2D_IMAGE_SELECTION,
index e994589b1e88481c4c20b51655306ed7e13c90d7..402931bf0fe8fff48265f06317a5b45e92afb43c 100644 (file)
@@ -47,8 +47,8 @@ D 0x0008 0x0033 3
 D 0x0020 0x4000 3 
 #D 0x0004 0x1500 4 
 #D 0x0004 0x1501 4 
-#D 0x0028 0x1052 3 
-#D 0x0028 0x1053 3 
+D 0x0028 0x1052 3 
+D 0x0028 0x1053 3 
 #D 0x0050 0x0004 3 
 #D 0x0020 0x0052 3 
 #D 0x0008 0x0016 3