X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmSQItem.cxx;h=597d833cb01e8c8ab4e308483e134f93bc04d71a;hb=8ac4df8c7543a827c7b89fc9bbcf86625f3c1afe;hp=7d61d3cce28c878c633614ee0561903aa5fcc2ff;hpb=3fd520b58c8d1939994de2c63cc038c3e7ac9522;p=gdcm.git diff --git a/src/gdcmSQItem.cxx b/src/gdcmSQItem.cxx index 7d61d3cc..597d833c 100644 --- a/src/gdcmSQItem.cxx +++ b/src/gdcmSQItem.cxx @@ -3,12 +3,12 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.cxx,v $ Language: C++ - Date: $Date: 2004/08/26 15:29:53 $ - Version: $Revision: 1.24 $ + Date: $Date: 2004/09/27 08:39:07 $ + Version: $Revision: 1.28 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or - http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details. + http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR @@ -33,9 +33,9 @@ * \brief Constructor from a given gdcmSQItem */ gdcmSQItem::gdcmSQItem(int depthLevel ) - : gdcmDocEntrySet(depthLevel) + : gdcmDocEntrySet( ) { - SQDepthLevel = depthLevel +1; + SQDepthLevel = depthLevel; } /** @@ -57,7 +57,7 @@ gdcmSQItem::~gdcmSQItem() /* * \brief canonical Printer */ - void gdcmSQItem::Print(std::ostream & os) + void gdcmSQItem::Print(std::ostream& os) { std::ostringstream s; @@ -95,19 +95,24 @@ gdcmSQItem::~gdcmSQItem() * \ingroup gdcmSQItem * \brief canonical Writer */ -void gdcmSQItem::Write(FILE *fp,FileType filetype) +void gdcmSQItem::Write(FILE* fp,FileType filetype) { + uint16_t item[4] = { 0xfffe, 0xe000, 0xffff, 0xffff }; + uint16_t itemt[4]= { 0xfffe, 0xe00d, 0xffff, 0xffff }; + + //we force the writting of an 'Item' Start Element + // because we want to write the Item as a 'no Length' item + fwrite(&item[0],8,1,fp); // fffe e000 ffff ffff + for (ListDocEntry::iterator i = docEntries.begin(); i != docEntries.end(); ++i) - { - // Item Delimitor Item IS the last one of a 'no length' SQItem - // (when it exists) we don't write it right now - // It will be written outside, because ALL the SQItems are written - // as 'no length' - if ( (*i)->IsItemDelimitor() ) + { + // we skip delimitors (start and end one) because + // we force them as 'no length' + if ( (*i)->GetGroup() == 0xfffe ) { - break; + continue; } // Fix in order to make some MR PHILIPS images e-film readable @@ -115,13 +120,16 @@ void gdcmSQItem::Write(FILE *fp,FileType filetype) // we just *always* ignore spurious fffe|0000 tag ! if ( (*i)->GetGroup() == 0xfffe && (*i)->GetElement() == 0x0000 ) { - break; + break; // FIXME : continue; ?!? } - // It's up to the gdcmDocEntry Writter to write the SQItem begin element - // (fffe|e000) as a 'no length' one (*i)->Write(fp, filetype); - } + } + + //we force the writting of an 'Item Delimitation' item + // because we wrote the Item as a 'no Length' item + fwrite(&itemt[0],8,1,fp); // fffe e000 ffff ffff + } //----------------------------------------------------------------------------- @@ -129,7 +137,7 @@ void gdcmSQItem::Write(FILE *fp,FileType filetype) /** * \brief adds any Entry (Dicom Element) to the Sequence Item */ -bool gdcmSQItem::AddEntry(gdcmDocEntry *entry) +bool gdcmSQItem::AddEntry(gdcmDocEntry* entry) { docEntries.push_back(entry); //TODO : check if it worked @@ -149,7 +157,7 @@ bool gdcmSQItem::AddEntry(gdcmDocEntry *entry) * @return true if element was found or created successfully */ -bool gdcmSQItem::SetEntryByNumber(std::string val,uint16_t group, +bool gdcmSQItem::SetEntryByNumber(std::string val, uint16_t group, uint16_t element) { for(ListDocEntry::iterator i = docEntries.begin(); i != docEntries.end(); ++i) @@ -227,7 +235,7 @@ bool gdcmSQItem::SetEntryByNumber(std::string val,uint16_t group, * \brief Gets a Dicom Element inside a SQ Item Entry, by number * @return */ -gdcmDocEntry *gdcmSQItem::GetDocEntryByNumber(uint16_t group, uint16_t element) +gdcmDocEntry* gdcmSQItem::GetDocEntryByNumber(uint16_t group, uint16_t element) { for(ListDocEntry::iterator i = docEntries.begin(); i != docEntries.end(); ++i)