X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvMeshReader.cxx;h=fb0baf47a10c0edd5cd9ef7edb01dbab36db1bf6;hb=46be2767c9b36e078ef58491d620b45da28eb55e;hp=fc420d4a0d887b07243891fd5c7c9d84142f13b4;hpb=c69e6ac8e16ac42d32f3a13d60396ddf65616188;p=clitk.git diff --git a/vv/vvMeshReader.cxx b/vv/vvMeshReader.cxx index fc420d4..fb0baf4 100644 --- a/vv/vvMeshReader.cxx +++ b/vv/vvMeshReader.cxx @@ -3,7 +3,7 @@ Authors belong to: - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even @@ -14,16 +14,19 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ +===========================================================================**/ #include #include #include #if GDCM_MAJOR_VERSION == 2 + #include + #include + #include #else -#include -#include + #include + #include #endif #include @@ -86,6 +89,33 @@ std::vector > vvMeshReader::GetROINames() assert(filename!=""); std::vector > roi_names; #if GDCM_MAJOR_VERSION == 2 + // duplicate code from clitk::DicomRT_StructureSet::Read + gdcm::Reader reader; + reader.SetFileName( filename.c_str() ); + reader.Read(); + + const gdcm::DataSet &ds = reader.GetFile().GetDataSet(); + + gdcm::Tag tssroisq(0x3006,0x0020); + const gdcm::DataElement &ssroisq = ds.GetDataElement( tssroisq ); + gdcm::SmartPointer roi_seq = ssroisq.GetValueAsSQ(); + assert(roi_seq); // TODO error message + for(unsigned int ridx = 0; ridx < roi_seq->GetNumberOfItems(); ++ridx) + { + gdcm::Item & item = roi_seq->GetItem( ridx + 1); // Item starts at 1 + const gdcm::DataSet& nestedds = item.GetNestedDataSet(); + if( nestedds.FindDataElement( gdcm::Tag(0x3006,0x22) ) ) + { + gdcm::Attribute<0x3006,0x26> roiname; + roiname.SetFromDataSet( nestedds ); + std::string name = roiname.GetValue(); // 0x3006,0x0026 = [ROI Name] + gdcm::Attribute<0x3006,0x0022> roinumber; + roinumber.SetFromDataSet( nestedds ); + int nb = roinumber.GetValue(); // 0x3006,0x0022 = [ROI Number] + + roi_names.push_back(make_pair(nb,name)); + } + } #else gdcm::File reader; reader.SetFileName(filename.c_str());