From c6ff4e54b4cbc10949278782648adbbca203fa6e Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 11 Dec 2013 08:42:45 +0100 Subject: [PATCH] 2188 creaImageIO Feature New Normal ImagesChooserDialog Box return DICOM tags maps --- ...bcreaImageIOGetDicomAttributesFromMaps.cxx | 84 +++++++++++++++++++ .../bbcreaImageIOGetDicomAttributesFromMaps.h | 49 +++++++++++ .../bbcreaImageIOImagesChooserDialogBox.xml | 6 +- src/creaImageIOWxSimpleDlg.cpp | 19 ++--- src/creaImageIOWxSimpleDlg.h | 2 + 5 files changed, 146 insertions(+), 14 deletions(-) create mode 100644 bbtk/src/bbcreaImageIOGetDicomAttributesFromMaps.cxx create mode 100644 bbtk/src/bbcreaImageIOGetDicomAttributesFromMaps.h diff --git a/bbtk/src/bbcreaImageIOGetDicomAttributesFromMaps.cxx b/bbtk/src/bbcreaImageIOGetDicomAttributesFromMaps.cxx new file mode 100644 index 0000000..bd45183 --- /dev/null +++ b/bbtk/src/bbcreaImageIOGetDicomAttributesFromMaps.cxx @@ -0,0 +1,84 @@ +//===== +// 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) +//===== +#include "bbcreaImageIOGetDicomAttributesFromMaps.h" +#include "bbcreaImageIOPackage.h" +namespace bbcreaImageIO +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaImageIO,GetDicomAttributesFromMaps) +BBTK_BLACK_BOX_IMPLEMENTATION(GetDicomAttributesFromMaps,bbtk::AtomicBlackBox); +//===== +// 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) +//===== +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 +// INPUT/OUTPUT ACCESSORS ARE OF THE FORM : +// void bbSet{Input|Output}NAME(const TYPE&) +// const TYPE& bbGet{Input|Output}NAME() const +// Where : +// * NAME is the name of the input/output +// (the one provided in the attribute 'name' of the tag 'input') +// * TYPE is the C++ type of the input/output +// (the one provided in the attribute 'type' of the tag 'input') + + std::vector< std::string > lstResult; + std::map tmpMap; + int i,size=bbGetInputIn().size(); + std::string strElement; + + for (i=0;isecond; + lstResult.push_back( strElement ); + } // 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) +//===== +void GetDicomAttributesFromMaps::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 +// bbSetInputIn(0); + +} +//===== +// 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) +//===== +void GetDicomAttributesFromMaps::bbUserInitializeProcessing() +{ + +// THE INITIALIZATION METHOD BODY : +// Here does nothing +// but this is where you should allocate the internal/output pointers +// if any + + +} +//===== +// 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) +//===== +void GetDicomAttributesFromMaps::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbcreaImageIO + + diff --git a/bbtk/src/bbcreaImageIOGetDicomAttributesFromMaps.h b/bbtk/src/bbcreaImageIOGetDicomAttributesFromMaps.h new file mode 100644 index 0000000..3b98bfd --- /dev/null +++ b/bbtk/src/bbcreaImageIOGetDicomAttributesFromMaps.h @@ -0,0 +1,49 @@ +//===== +// 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) +//===== +#ifndef __bbcreaImageIOGetDicomAttributesFromMaps_h_INCLUDED__ +#define __bbcreaImageIOGetDicomAttributesFromMaps_h_INCLUDED__ +#include "bbcreaImageIO_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +namespace bbcreaImageIO +{ + +typedef std::map mapString; + +class bbcreaImageIO_EXPORT GetDicomAttributesFromMaps + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(GetDicomAttributesFromMaps,bbtk::AtomicBlackBox); +//===== +// 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) +//===== + BBTK_DECLARE_INPUT(In,std::vector< mapString > ); + BBTK_DECLARE_INPUT(KeyDicom, std::string); + BBTK_DECLARE_OUTPUT(Out,std::vector ); + BBTK_PROCESS(Process); + void Process(); +//===== +// 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) +//===== +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(GetDicomAttributesFromMaps,bbtk::AtomicBlackBox); +BBTK_NAME("GetDicomAttributesFromMaps"); +BBTK_AUTHOR("Info-Dev, Eduardo DAVIL"); +BBTK_DESCRIPTION("eduardo.davila[at]creatis.insa-lyon.fr -"); +BBTK_CATEGORY("empty"); + BBTK_INPUT(GetDicomAttributesFromMaps,In,"Vector of maps with DICOM attributes",std::vector< mapString >,""); + BBTK_INPUT(GetDicomAttributesFromMaps,KeyDicom,"Key DICOM",std::string ,""); + BBTK_OUTPUT(GetDicomAttributesFromMaps,Out,"Vector of the attribute asked.",std::vector ,""); +BBTK_END_DESCRIBE_BLACK_BOX(GetDicomAttributesFromMaps); +//===== +// 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) +//===== +} +// EO namespace bbcreaImageIO + +#endif // __bbcreaImageIOGetDicomAttributesFromMaps_h_INCLUDED__ + diff --git a/bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml b/bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml index e240738..454f883 100644 --- a/bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml +++ b/bbtk/src/bbcreaImageIOImagesChooserDialogBox.xml @@ -52,7 +52,7 @@
       typedef std::vector VectorStringType;
- +
@@ -71,14 +71,16 @@
       typedef std::vector< MapInfoDicom > VectorMapInfoDicom;
- +
+     
         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){ 
diff --git a/src/creaImageIOWxSimpleDlg.cpp b/src/creaImageIOWxSimpleDlg.cpp
index 6a6621e..a537b32 100644
--- a/src/creaImageIOWxSimpleDlg.cpp
+++ b/src/creaImageIOWxSimpleDlg.cpp
@@ -146,14 +146,7 @@ namespace creaImageIO
 				dlg.stopReading();
 
 				std::vector outStrGimmick;
-				std::vector 		attrDicomTags;
-
-				   attrDicomTags.push_back("D0028_0010");
-				   attrDicomTags.push_back("D0008_0023");
-				   attrDicomTags.push_back("D0008_1070");
-				   attrDicomTags.push_back("D0019_100e");
-
-				dlg.getSelected(outStrGimmick, attrDicomTags,true,"");
+				dlg.getSelected(outStrGimmick, m_attrDicomTags,true,"");
 
 			m_results.clear();
 			int size=(int)outStrGimmick.size();
@@ -163,10 +156,6 @@ namespace creaImageIO
 				for (ii=0;iisecond.c_str() );
-					printf("EED WxSimpleDlg::OnReadGimmick D0008_0023 %s\n", outStrGimmick[ii].infos.find("D0008_0023")->second.c_str() );
-					printf("EED WxSimpleDlg::OnReadGimmick D0008_1070 %s\n", outStrGimmick[ii].infos.find("D0008_1070")->second.c_str() );
-					printf("EED WxSimpleDlg::OnReadGimmick D0019_100e %s\n", outStrGimmick[ii].infos.find("D0019_100e")->second.c_str() );
 					m_resultsDicomAtr.push_back( outStrGimmick[ii].infos );
 				}
 //			} else {
@@ -200,6 +189,12 @@ namespace creaImageIO
 		return m_resultsDicomAtr;
 	}
 
+	void WxSimpleDlg::SetAttrDicomTags( std::vector attr )
+	{
+		m_attrDicomTags=attr;
+	}
 	  
+
+
 }
 
diff --git a/src/creaImageIOWxSimpleDlg.h b/src/creaImageIOWxSimpleDlg.h
index 8741258..5e3f5f0 100644
--- a/src/creaImageIOWxSimpleDlg.h
+++ b/src/creaImageIOWxSimpleDlg.h
@@ -61,6 +61,7 @@ namespace creaImageIO
 		   wxString getInfoImage();
 
 		   std::vector< std::map >  getDicomInfoImagesSelected();
+		   void SetAttrDicomTags( std::vector attr );
 
 
 		   void setInfo(bool i_val){bInfo = i_val;}
@@ -82,6 +83,7 @@ namespace creaImageIO
 		/// vtkImageData vector
 		std::vector 				m_results;
 		std::vector< std::map > 	m_resultsDicomAtr;
+		std::vector 				m_attrDicomTags;    // DXXXX_YYYY DAAAA_BBBB ...
 
 		std::vector m_resultsInfo;
 		
-- 
2.45.0