[ome-users] ImageProcessorReader.getSeriesMetadata() for extracting DICOM tags

Helen Flynn h.flynn at dundee.ac.uk
Wed Apr 16 09:38:24 BST 2014


Dear Mohammad,

Sorry to hear this still isn't working for you. Could you submit the image file via http://qa.openmicroscopy.org.uk so we can do further testing please?

Regards,

Helen


Dr Helen Flynn
OME Technical Writer
Centre for Gene Regulation & Expression
Open Microscopy Environment
University of Dundee
http://openmicroscopy.org

On 11 Apr 2014, at 16:25, Mohammad Samarah <isamarah at mac.com<mailto:isamarah at mac.com>> wrote:

Hi Melissa,

We tried both options. We are unable to retrieve the nested DICOM tags. Here
is the code fragment in question.

Thanks for your help,
M. Samarah


ServiceFactory factory = new ServiceFactory();
OMEXMLService service = factory.getInstance(OMEXMLService.class);
IMetadata meta = service.createOMEXMLMetadata();

log_message("INFO: Examining file " + imagePath);
r.setMetadataStore(meta);
r.setGroupFiles(false);
r.setId(imagePath);

CoreMetadata data[] = r.getCoreMetadata();
metadata = data[r.getCoreIndex()].seriesMetadata;
Set<String> keys = metadata.keySet();

for(String key: keys)
{
   System.out.println("Value of "+key+" is: "+metadata.get(key));
}

Object obj = r.getSeriesMetadataValue("0008,2228 Primary Anatomic Structure
Sequence");

if (obj instance of List)
{
   System.out.println("obj is a list");
   // order they were found
   //  List values = (List) obj;
   // Object firstCodeMeaning = values.get(0);
}
else {
   // single value
   System.out.println("obj is a single value");
}

From: Melissa Linkert <melissa at glencoesoftware.com<mailto:melissa at glencoesoftware.com>>
Reply-To: <melissa at glencoesoftware.com<mailto:melissa at glencoesoftware.com>>
Date: Mon, 07 Apr 2014 18:59:58 -0500
To: "msamarah at alumni.fit.edu<mailto:msamarah at alumni.fit.edu>" <msamarah at alumni.fit.edu<mailto:msamarah at alumni.fit.edu>>
Cc: "ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>"
<ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>>
Subject: Re: [ome-users] ImageProcessorReader.getSeriesMetadata() for
extracting DICOM tags

Hi Mohammad,

We are using ImageProcessorReader to extract DICOM tags from an RVG image.
All seems to be well, however it does not seem to return repeating tags
particularly tag id 0008,0104.  Are there specific options needed to extract
repeated tags? And are there known limitations with the Imetadata class? I
have attached the DICOM tags table and Java code in question below.

Typically if there would be multiple entries in the metadata hashtable
that have the same key, then a suffix is appended to the relevant keys.
I would expect something like this to work:

    metadata = r.getSeriesMetadata();
    Object firstCodeMeaning = metadata.get("Code Meaning #0");
    Object secondCodeMeaning = metadata.get("Code Meaning #1");
    Object thirdCodeMeaning = metadata.get("Code Meaning #2");

Alternately, you can do this to preserve the original key and access the
values as a List:

   metadata = r.getCoreMetadataList().get(r.getCoreIndex()).seriesMetadata;
   Object value = metadata.get("Code Meaning");
   if (value instanceof List) {
     // multiple values for the same key; values are stored in the
     // order they were found
     List values = (List) value;
     Object firstCodeMeaning = values.get(0);
   }
   else {
     // single value
   }

If neither of those options work, please let us know.

Regards,
-Melissa

On Fri, Apr 04, 2014 at 01:48:30AM -0400, Mohammad Samarah wrote:
We are using ImageProcessorReader to extract DICOM tags from an RVG image.
All seems to be well, however it does not seem to return repeating tags
particularly tag id 0008,0104.  Are there specific options needed to extract
repeated tags? And are there known limitations with the Imetadata class? I
have attached the DICOM tags table and Java code in question below.

Thanks for your help,
M. Samarah
msamarah at alumni.fit.edu<mailto:msamarah at alumni.fit.edu>


Tag ID                          VR    VM   Len    Description       Value
(0008,2228)                SQ    0      0       Primary Anatomic Structure
Sequence
  (FFFE,E000)
     (0008,0100)
     (0008,0102)
     (0008,0104)          LO  1        34      Code Meaning    Maxillary
right third molar tooth
  (FFFE,E000)
     (0008,0100)
     (0008,0102)
     (0008,0104)          LO  1        34      Code Meaning    Maxillary
right second molar tooth
  (FFFE,E000)
     (0008,0100)
     (0008,0102)
     (0008,0104)       LO  1           34      Code Meaning    Maxillary
right first molar tooth


ImageProcessorReader r = new ImageProcessorReader(new
ChannelSeparator(LociPrefs.makeImageReader()));
try
{
   ServiceFactory factory = new ServiceFactory();
   OMEXMLService service = factory.getInstance(OMEXMLService.class);
    IMetadata meta = service.createOMEXMLMetadata();
    log_message("INFO: Examining file " + imagePath);
    r.setMetadataStore(meta);
    r.setGroupFiles(false);
    r.setId(imagePath);

   metadata = r.getSeriesMetadata();
   Set<String> keys = metadata.keySet();
   for(String key: keys)
   {
       System.out.println("Value of "+key+" is: "+metadata.get(key));
    }
}


_______________________________________________
ome-users mailing list
ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users



_______________________________________________
ome-users mailing list
ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users


The University of Dundee is a registered Scottish Charity, No: SC015096
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20140416/ec693472/attachment.html>


More information about the ome-users mailing list