Search code examples
imebra

How to get all the data from a DICOM file with Imebra


I am working on a project that integrates Imebra inside an android application. The application is supposed to extract all the data from a given DICOM file and put them into a .xml file. I need a little bit of help with it. For example, I don't know how to get all the VR tags that the given DICOM has, instead of getting them one by one using tag ids. Thank you for your help.


Solution

  • Load the file using CodecFactory.load(filename).

    Then you can use DataSet.getTags() to retrieve a list of tags stored into the DICOM structure.

    The returned class TagsIds is a list containing all the TagId: scan each tag ID and retrieve it via DataSet.getString() (to retrieve the value as string) and DataSet.getDataType() to retrieve its VR.

    When DataSet.getString() fails then you are dealing with a sequence (an embedded DICOM structure) which can be retrieved with DataSet.getSequenceItem().

    You can use the static method DicomDictionary.getTagName() to get a description of a particular tag.