DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Mon, 2017-05-29, 10:43

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu, 2010-04-15, 15:15 
Offline

Joined: Mon, 2008-10-20, 08:37
Posts: 24
Hi J


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 2010-04-15, 18:04 
Offline
ICSMED DICOM Services
ICSMED DICOM Services

Joined: Fri, 2004-10-29, 21:38
Posts: 2217
Location: Oldenburg, Germany
No, unfortunately, not -- at least not at the moment. This is something that could possibly be handled by a higher level API which is still to be defined/developed ...


Top
 Profile  
 
 Post subject:
PostPosted: Mon, 2010-04-19, 08:20 
Offline

Joined: Tue, 2009-09-22, 12:57
Posts: 18
Location: DKFZ Heidelberg
I can provide a piece of code that reads structures and returns the point coordinates as multidimensional stl::vector, if this would be helpful.


Top
 Profile  
 
 Post subject:
PostPosted: Mon, 2010-04-19, 08:25 
Offline

Joined: Mon, 2008-10-20, 08:37
Posts: 24
Oliver Nix wrote:
I can provide a piece of code that reads structures and returns the point coordinates as multidimensional stl::vector, if this would be helpful.

That will be very grateful to you!Please mail the piece of code to christcandy@yahoo.cn.
Best Regards,
Candy


Top
 Profile  
 
PostPosted: Fri, 2010-11-05, 11:19 
Offline

Joined: Fri, 2010-11-05, 10:30
Posts: 1
Hi,

I would like to extract the structures PTV(s) and OAR(s) including points e.g. isocentre, Dose normalisation point etc from a DICOM RT Structure set as stl::vectors. The code from Oliver Nix appears to do this. Could someone please post the code to me: markbgainey@yahoo.com


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon, 2010-11-08, 10:18 
Offline

Joined: Tue, 2009-09-22, 12:57
Posts: 18
Location: DKFZ Heidelberg
How to extract structures by name

Structures by name can be extracted using this code.
This code searches for a ROI with the name VOIname.
The ROI name is stored in tag (3006,0026). This is of type 2. It must exist but it can remain empty. This code reads all ROI names in the ROI sequence (3006,0020) and compares them with the string VOIname. In case of a hit the ROI Number is extracted (3006,0022) from this sequence item. This tag is of type 1, so it must exist. Then the function getContourData(VOIid,VOIdata) is called which extracts the coordinate triplets of your ROI and stores them in FloatVector3D &VOIdata.
FloatVector3D is a typedef for
typedef OFVector<OFVector<OFVector<Float32> > > FloatVector3D;
and OFVector is a std::vector object.


Code:
OFBool DRTStructureSet::getContourData(OFString VOIname, FloatVector3D &VOIdata)
{
 OFBool success = OFTrue;
 Uint32 VOIid=-1,ctr;
 DRTStructureSetROISequence &strset_sequence =  getStructureSetROISequence();
 if(!strset_sequence.isEmpty())
  {
  if (strset_sequence.gotoFirstItem().good())
   {
    ctr = 0;
    do
     {
       DRTStructureSetROISequence::Item seq_item = strset_sequence.getCurrentItem();
       OFString name;
       seq_item.getROIName(name);
       if(name.compare(VOIname) == 0)
        {
         OFString voi_number;
         if((seq_item.getROINumber(voi_number)).good())
          {
           VOIid = atoi(voi_number.c_str());
           break;
          }
        } 
      } while(strset_sequence.gotoNextItem().good());
    }
    else
    {
     DCMRT_ERROR("DRTStructure Set :: getContourData :: structure set sequence first item status bad");
     success = OFFalse;
    }
 }
 else
 {
  DCMRT_ERROR("DRTStructure Set :: getContourData :: structure set sequence is empty");
  success = OFFalse;
 }

 if(VOIid > 0)
   if(!(getContourData(VOIid,VOIdata)))
    {
     DCMRT_ERROR("DRTStructure Set :: getContourData returned success false");
     success = OFFalse;
    }

return success;
}


Code:
OFBool DRTStructureSet::getContourData(Uint32 VOIid, FloatVector3D &VOIdata)
{

DRTROIContourSequence &voi_sequence =  getROIContourSequence();
DRTROIContourSequence::Item &voi = voi_sequence.getItem(VOIid);
DRTContourSequence roi_sequence = voi.getContourSequence();
Uint32 num_rois = roi_sequence.getNumberOfItems();
VOIdata.resize(num_rois);

  for(Uint32 i = 0; i < roi_sequence.getNumberOfItems(); i++)
  {
    DRTContourSequence::Item roi = roi_sequence.getItem(i);
    OFString numpoints;
    roi.getNumberOfContourPoints(numpoints);
    VOIdata[i].resize(atoi(numpoints.c_str()));
    for(Uint32 j=0;j<(Uint32)atoi(numpoints.c_str());j++)
    {
     VOIdata[i][j].resize(3);
    }
  }
 
Uint32 roi_ctr=0;

if(!roi_sequence.isEmpty())
 {
 if (roi_sequence.gotoFirstItem().good())
  {
   roi_ctr = 0;
   do
    {
     DRTContourSequence::Item &roi = roi_sequence.getCurrentItem();
     if(!roi.isEmpty())
     {
      OFString num_cont_points = "-1";
      roi.getNumberOfContourPoints(num_cont_points);
      Uint32 num_poins = atoi(num_cont_points.c_str());
      for(Uint32 i = 0; i < num_poins; i++)
        {
         for(Uint32 j = 0; j < 3; j++)
         {
          OFString roidata;
          roi.getContourData(roidata,i*3+j);
          VOIdata[roi_ctr][i][j] = OFstatic_cast(Float32,atof(roidata.c_str()));
         }
        }
       }
        ++roi_ctr;
       } while (roi_sequence.gotoNextItem().good());
    }
   }
return OFTrue;
}



Dose Normalisation Point

The dose normalisation point is stored in the RT Dose module.
Open your dose file and read it to a DRTDoseIOD object in the using the read function of this class.
Use the member function
virtual OFCondition getNormalizationPoint(OFString &value, const signed long pos = 0) const;
to get the normalization point.
Since this tag is of type 3 it might not be present in your dataset.

I hope this helps


Top
 Profile  
 
 Post subject:
PostPosted: Mon, 2010-11-08, 10:38 
Offline
ICSMED DICOM Services
ICSMED DICOM Services

Joined: Fri, 2004-10-29, 21:38
Posts: 2217
Location: Oldenburg, Germany
Btw, there is also an integer variant of getROINumber(), so there is no need to use atoi() anymore.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group