From: Eduardo DAVILA Date: Wed, 4 Apr 2018 05:40:58 +0000 (+0200) Subject: #3184 BBTK Feature New Normal - In GetXCoherentInfoGdcmReader box extract Dicom... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=bbtk.git;a=commitdiff_plain;h=fef49cf06296bb65a839585dba63f282a89d91fc #3184 BBTK Feature New Normal - In GetXCoherentInfoGdcmReader box extract Dicom Attributes --- diff --git a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx index 197ed03..faabc03 100644 --- a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx +++ b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.cxx @@ -106,7 +106,9 @@ void GetXCoherentInfoGdcmReader::Process() f->GetImageOrientationPatient(iop); for(i=0; i< 6; i++) + { v_iop.push_back(iop[i]); + } bbSetOutputIOP(v_iop ); std::vector v_ipp; @@ -114,7 +116,9 @@ void GetXCoherentInfoGdcmReader::Process() f->GetImagePositionPatient(ipp); for(i=0; i< 3; i++) + { v_ipp.push_back(ipp[i]); + } bbSetOutputIPP(v_ipp ); // Add *all the files* to the SerieHelper @@ -135,9 +139,7 @@ void GetXCoherentInfoGdcmReader::Process() // Should only contain one! l = sh->GetFirstSingleSerieUIDFileSet(); - int nbFiles; double zspacing = 0.; - nbFiles = l->size() ; sh->OrderFileList(l); // this one should compute the *actual* Z Spacing! zspacing = sh->GetZSpacing(); std::vector v_pixelspacing; @@ -149,6 +151,34 @@ void GetXCoherentInfoGdcmReader::Process() // } bbSetOutputPixelSpacing(v_pixelspacing); + VectorMapInfoDicom vectormapinfodicom; + uint16_t group; + uint16_t elem; + std::string key; + std::string strTagValue; // read on disc + int iTag,sizeDicomTagsVector=bbGetInputDicomTags().size(); + GDCM_NAME_SPACE::FileList::const_iterator iitt = l->begin(); + //iitt ++; + for ( ; iitt != l->end(); ++iitt) + { + MapInfoDicom mapinfodicom; + + for (iTag=0; iTagGetEntryString(group,elem); + mapinfodicom.insert ( std::pair(key,strTagValue) ); + } // for iTag + + vectormapinfodicom.push_back( mapinfodicom ); + } // for iitt + bbSetOutputDicomInfo( vectormapinfodicom ); + if (reader!=NULL) { reader->Delete(); diff --git a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h index a37304b..f0b3c21 100644 --- a/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h +++ b/packages/gdcmvtk/src/bbgdcmvtkGetXCoherentInfoGdcmReader.h @@ -47,20 +47,25 @@ #include "vtkImageData.h" namespace bbgdcmvtk { + typedef std::map MapInfoDicom; + typedef std::vector< MapInfoDicom > VectorMapInfoDicom; class bbgdcmvtk_EXPORT GetXCoherentInfoGdcmReader : public bbtk::AtomicBlackBox { + BBTK_BLACK_BOX_INTERFACE(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox); - BBTK_DECLARE_INPUT(In, std::vector); - BBTK_DECLARE_INPUT(IPPSort, bool); + BBTK_DECLARE_INPUT(In , std::vector); + BBTK_DECLARE_INPUT(IPPSort , bool); + BBTK_DECLARE_INPUT(DicomTags , std::vector); - BBTK_DECLARE_OUTPUT(Out, vtkImageData *); - BBTK_DECLARE_OUTPUT(IPP, std::vector); - BBTK_DECLARE_OUTPUT(IOP, std::vector); - BBTK_DECLARE_OUTPUT(PixelSpacing, std::vector); + BBTK_DECLARE_OUTPUT(Out , vtkImageData *); + BBTK_DECLARE_OUTPUT(IPP , std::vector); + BBTK_DECLARE_OUTPUT(IOP , std::vector); + BBTK_DECLARE_OUTPUT(PixelSpacing , std::vector); + BBTK_DECLARE_OUTPUT(DicomInfo , VectorMapInfoDicom); BBTK_PROCESS(Process); void Process(); @@ -83,18 +88,20 @@ class bbgdcmvtk_EXPORT GetXCoherentInfoGdcmReader //================================================================= // UserBlackBox description BBTK_BEGIN_DESCRIBE_BLACK_BOX(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox); -BBTK_NAME("GetXCoherentInfoGdcmReader"); -BBTK_AUTHOR("jpr, eduardo"); -BBTK_DESCRIPTION("Get Dicom info from a File Set (a list of Dicom image file names) and read (as a vtkImageData)"); -BBTK_CATEGORY(""); - -BBTK_INPUT(GetXCoherentInfoGdcmReader,In, "List of Dicom image file names", std::vector,""); -BBTK_INPUT(GetXCoherentInfoGdcmReader,IPPSort,"Sort on Image Position Patient",bool,""); - -BBTK_OUTPUT(GetXCoherentInfoGdcmReader,Out, "Output image", vtkImageData *,""); -BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IPP, "Image Position (Patient)", std::vector,""); -BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IOP, "Image Orientation (Patient)", std::vector,""); -BBTK_OUTPUT(GetXCoherentInfoGdcmReader,PixelSpacing,"Pixel Spacing", std::vector,""); + BBTK_NAME("GetXCoherentInfoGdcmReader"); + BBTK_AUTHOR("jpr, eduardo"); + BBTK_DESCRIPTION("Get Dicom info from a File Set (a list of Dicom image file names) and read (as a vtkImageData)"); + BBTK_CATEGORY(""); + + BBTK_INPUT(GetXCoherentInfoGdcmReader,In ,"List of Dicom image file names", std::vector,""); + BBTK_INPUT(GetXCoherentInfoGdcmReader,IPPSort ,"Sort on Image Position Patient", bool,""); + BBTK_INPUT(GetXCoherentInfoGdcmReader,DicomTags ,"Dicom Tags (vector of Dicom tags ex: D0028_0030 D0020_0037)", std::vector,""); + + BBTK_OUTPUT(GetXCoherentInfoGdcmReader,Out ,"Output image" , vtkImageData *,""); + BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IPP ,"Image Position (Patient)" , std::vector,""); + BBTK_OUTPUT(GetXCoherentInfoGdcmReader,IOP ,"Image Orientation (Patient)" , std::vector,""); + BBTK_OUTPUT(GetXCoherentInfoGdcmReader,PixelSpacing ,"Pixel Spacing" , std::vector,""); + BBTK_OUTPUT(GetXCoherentInfoGdcmReader,DicomInfo ,"vector of maps of Dicom tags" , VectorMapInfoDicom,""); BBTK_END_DESCRIBE_BLACK_BOX(GetXCoherentInfoGdcmReader); } // EO namespace bbgdcmvtk