Mercurial > hg > orthanc
diff OrthancServer/ParsedDicomFile.cpp @ 992:af014624dac1 plugins
integration mainline->plugins
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 02 Jul 2014 13:53:56 +0200 |
parents | 509e146c3cb3 2f76b92addd4 |
children | f009f7c75069 |
line wrap: on
line diff
--- a/OrthancServer/ParsedDicomFile.cpp Tue Jul 01 16:54:34 2014 +0200 +++ b/OrthancServer/ParsedDicomFile.cpp Wed Jul 02 13:53:56 2014 +0200 @@ -756,24 +756,42 @@ - void ParsedDicomFile::RemovePrivateTags() + void ParsedDicomFile::RemovePrivateTagsInternal(const std::set<DicomTag>* toKeep) { + DcmDataset& dataset = *pimpl_->file_->getDataset(); + + // Loop over the dataset to detect its private tags typedef std::list<DcmElement*> Tags; - Tags privateTags; - DcmDataset& dataset = *pimpl_->file_->getDataset(); for (unsigned long i = 0; i < dataset.card(); i++) { DcmElement* element = dataset.getElement(i); DcmTag tag(element->getTag()); - if (!strcmp("PrivateCreator", tag.getTagName()) || // TODO - This may change with future versions of DCMTK - tag.getPrivateCreator() != NULL) + + // Is this a private tag? + if (FromDcmtkBridge::IsPrivateTag(tag)) { - privateTags.push_back(element); + bool remove = true; + + // Check whether this private tag is to be kept + if (toKeep != NULL) + { + DicomTag tmp = FromDcmtkBridge::Convert(tag); + if (toKeep->find(tmp) != toKeep->end()) + { + remove = false; // Keep it + } + } + + if (remove) + { + privateTags.push_back(element); + } } } + // Loop over the detected private tags to remove them for (Tags::iterator it = privateTags.begin(); it != privateTags.end(); ++it) {