how to change the value of DicomElement in a Sequence with dcm4che2

176 views
Skip to first unread message

stephen fogarasi

unread,
Jun 2, 2015, 5:27:03 PM6/2/15
to dcm...@googlegroups.com
 
Im trying to modify the value of tag inside of a sequence. I think my problem is that I am a bit confused between DicomObjects and DicomElements.  For DicomObjects, I have all the necessary methods, but within a Sequence, and I get the DicomElements, I have not methods to edit the values
 
So here is a chunk of code and how far I get
....
if ( tagVR == VR.SQ )
{
 System.out.println ( "Its a sequence : " );
        
 DicomElement sequence = dcmObj.get( tagEnum );
 if ( sequence != null )
 {
  if ( sequence.hasDicomObjects() )
  {
   System.out.println("\t...the sequence has " + sequence.countItems() + " items" );
   for ( int i = 0; i < sequence.countItems(); i++ )
   {
    DicomObject subDcmObj = sequence.getDicomObject( i );
    Iterator<DicomElement> iter = subDcmObj.iterator();
    while ( iter.hasNext() )
    {
     DicomElement element = iter.next();
     System.out.println ( "element has " + element.toString() );
     
     // ...so right here, how do I change the element value? DicomElements have no set methods...
     //
     ....
           
    }                 
   }
  }
 }
}

Dimitri Pianeta

unread,
Jun 3, 2015, 2:47:53 AM6/3/15
to dcm...@googlegroups.com
My solution is the file TestItemTag.java.
Create Tag with VR.SQ with differents Tag.
Example :
TAG ITEM : Tag.AnatomicRegionSequence
TAG in ITEM :  Tag.CodingSchemeDesignator with value "SRT"




TestItemTag.java

achraf touzani

unread,
Jul 9, 2015, 11:20:57 AM7/9/15
to dcm...@googlegroups.com
Hello Dimitri,

I am trying to edit some values in different sequence but i when i use your code, i add these values 

achraf touzani

unread,
Jul 9, 2015, 11:24:02 AM7/9/15
to dcm...@googlegroups.com
(Sorry wrong 


Le jeudi 9 juillet 2015 17:20:57 UTC+2, achraf touzani a écrit :
Hello Dimitri,

I am trying to edit some values in different sequence but i when i use your code, i add these values at the end of Dicom and not in the witched item. Do you have an idea to edit these values ?

Best regards,

Achraf 
Reply all
Reply to author
Forward
0 new messages