May I know how to call methods in the cpp to get the name, birthday, gender, and series and series description of the loaded dicom data.Thanks!

Well, I was calling the “qSlicerApplication::application()->dicomDatabase()” in the c++ code to get the currently loaded dicom data? i can see stdudy description information in dicom component, but the loading is done, I get study description information in the c, the display is empty. May I know how to call methods in the c++ code to get the name, birthday, gender, and series and series description of the loaded dicom data? Thank you so much! !!! !!! !
图片
图片

Dear Zhao,

I think you can use fileValue method if the DICOM data imported into Slicer (you must know a DICOM tag of the info you needed), or you can use DCMTK directly to load all the required information from the DICOM file.

3 Likes

I don’t understand this. What is empty?

You can get the raw DICOM tag values from the files as suggested by @Mik. However, you can also access most of this information from subject hierarchy. From the loaded data (volume node in your case) you can get to the study and patient items, which contain these information as attributes. Here are some pointers about how to use subject hierarchy
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Subject_hierarchy
And these are the attribute names

(please note that you need to use the attribute names not the tag names to get the attributes using shNode.GetItemAttribute)

2 Likes

See complete example in the script repository here: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#How_to_access_tag_of_an_item_in_the_Subject_Hierachy_tree.3F_For_example.2C_get_the_content_time_tag_of_a_structure_set:

1 Like

thank you, your help to me very much!

thank you and give me the prompt message!

Thank you for giving me great help!

Is through the above method, but still can not get the corresponding value ah! Could you help with the sticker code, c++ is the best ,thanks !

Since most of Slicer core is inplemented in C++, you can find C++ examples there for everything: https://github.com/Slicer/Slicer

Thank you very much!

Hi @lassoan .
I can´t access this link:

Documentation/Nightly/ScriptRepository - Slicer Wiki

Could you update it?
Thanks in advance!

The Slicer script repository was moved here a few years ago: Script repository — 3D Slicer documentation

1 Like