7 #include "fwGdcmIO/helper/DicomCodedAttribute.hpp" 25 const std::regex codeRegex(
"\\(([^;]+);([^;]+);([^;)]+)\\)");
28 auto textIt = entry.begin();
35 while(std::regex_search(textIt, entry.end(), match, codeRegex))
38 textIt = match[0].second;
49 ::gdcm::Segment::BasicCodedEntryVector result;
52 for(
const auto& attribute : codedAttributes)
54 result.push_back(attribute.toGDCMFormat());
64 const std::string input = entry;
66 std::vector<std::string> attributeContainer;
68 const std::regex codeRegex(
"(\\([^;]+;[^;]+;[^;)]+\\))");
71 auto textIt = input.begin();
74 while(std::regex_search(textIt, input.end(), match, codeRegex))
76 attributeContainer.push_back(match[1]);
77 textIt = match[0].second;
82 if(attributeContainer.size() == 1 || (attributeContainer.size() > 1 && multipleValue))
85 for(
const auto& attribute : attributeContainer)
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
This class represents a DICOM basic coded entry. It stores the four mains attributes : Code Value...
static FWGDCMIO_API bool checkAndFormatEntry(std::string &entry, bool multipleValue=false)
Retrieve '(AAA;BBB;CCC)' patterns inside of the entry string. Remove spaces or other characters that ...
static FWGDCMIO_API::gdcm::Segment::BasicCodedEntryVector convertEntryToGDCMCodedAttribute(const std::string &entry)
Convert an entry of the form '(AAA;BBB;CCC)' into GDCM's BasicCodedEntryVector. Several DicomCodedAtt...
static FWGDCMIO_API DicomCodedAttributeVectorType convertEntryToCodedAttribute(const std::string &entry)
Convert an entry of the form '(AAA;BBB;CCC)' into a list of DicomCodedAttributes. Several DicomCodedA...
std::vector< ::fwGdcmIO::container::DicomCodedAttribute > DicomCodedAttributeVectorType
DicomCodedAttribute container type.