X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FcreaImageIOWxDumpPanel.cpp;h=a820960acf2e9c62b063cfa3523d6b871238d915;hb=0966c8da167c8a1546eb203da926e3b446398b68;hp=05b2da963c6649d8aa6bfb3ba59d922c3b89722e;hpb=795cc4e4921f94e0f759935bfc931e25ae12c865;p=creaImageIO.git diff --git a/src/creaImageIOWxDumpPanel.cpp b/src/creaImageIOWxDumpPanel.cpp index 05b2da9..a820960 100644 --- a/src/creaImageIOWxDumpPanel.cpp +++ b/src/creaImageIOWxDumpPanel.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #if defined(USE_GDCM) #include #include @@ -15,6 +16,8 @@ #include "gdcmDictPrinter.h" #include "gdcmPrinter.h" #include "gdcmReader.h" +#include "gdcmSmartPointer.h" +#include "gdcmSequenceOfItems.h" #endif #include "icons/save.xpm" @@ -79,6 +82,76 @@ namespace creaImageIO printer.Print( os ); result = os.str(); } + + + + //const gdcm::DataSet& ds = reader.GetFile().GetDataSet(); + // // (5400,0100) SQ (Sequence with undefined length #=1) # u/l, 1 WaveformSequence + // gdcm::Tag twsq(0x5400,0x0100); + // bool btest = ds.FindDataElement( twsq) ; + //const gdcm::DataElement &wsq = ds.GetDataElement( twsq ); + // gdcm::SmartPointer sqi = wsq.GetValueAsSQ(); + // int num = sqi->GetNumberOfItems(); + // + // const gdcm::Item & item = sqi->GetItem(1); // Item start at #1 + // const gdcm::DataSet& nestedds = item.GetNestedDataSet(); + + // // (5400,1004) US 16 # 2, 1 WaveformBitsAllocated + // gdcm::Tag twba(0x5400,0x1004); + // if( !nestedds.FindDataElement( twba ) ) + // { + // + // } + // const gdcm::DataElement &wba= nestedds.GetDataElement( twba ); + + // //std::cout << wba << std::endl; + // // (5400,1006) CS [SS] # 2, 1 WaveformSampleInterpretation + // // (5400,1010) OW 00ba\0030\ff76\ff8b\00a2\ffd3\ffae\ff50\0062\00c4\011e\00c2\00ba... # 57600, 1 WaveformData + // gdcm::Tag twd(0x5400,0x1010); + // if( !nestedds.FindDataElement( twd ) ) + // { + + // } + // const gdcm::DataElement &wd = nestedds.GetDataElement( twd ); + // const gdcm::ByteValue *bv = wd.GetByteValue(); + // size_t len = bv->GetLength(); + // int16_t *p = (int16_t*)bv; + // + // size_t npts = len / 2; + // //npts = 10; // DEBUG ! + // for(size_t i = 0; i < npts; ++i ) + // { + // float x; + // x = (float)p[i]; + // } + //// + //// gdcm::SmartPointer sqi = wsq.GetValueAsSQ(); + ////if( !sqi || !sqi->GetNumberOfItems() ) + //// { + //// + //// } + + //// const gdcm::Item & item = sqi->GetItem(1); // Item start at #1 + //// const gdcm::DataSet& nestedds = item.GetNestedDataSet(); + + //// // (5400,1004) US 16 # 2, 1 WaveformBitsAllocated + //// gdcm::Tag twba(0x5400,0x1004); + //// if( !nestedds.FindDataElement( twba ) ) + //// { + //// return 0; + //// } + //// const gdcm::DataElement &wba= nestedds.GetDataElement( twba ); + + + + // gdcm::DataElement data = reader.GetFile().GetDataSet().GetDataElement(gdcm::Tag(0x5400,0x0100)); + // std::string seq_old_begin = "(fffe,e000) na (Item with undefined length)"; + // std::string seq_new_begin = ""; + // boost::algorithm::replace_all(result, seq_old_begin, seq_new_begin); + // std::string seq_old_end = "(fffe,e00d)"; + // std::string seq_new_end = "<\\SEQ>"; + // boost::algorithm::replace_all(result, seq_old_end, seq_new_end); + //seq_old_end = "(fffe,e0dd)"; boost::algorithm::replace_all(result, seq_old_end, "\n"); #endif DumpText->SetValue(crea::std2wx(result));