# 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!

**URL:** https://discourse.slicer.org/t/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/11143
**Category:** Development
**Created:** [April 16, 2020, 7:16am UTC](https://discourse.slicer.org/t/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/11143 "2020-04-16T07:16:51Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Shicong](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shicong/32/6562_2.png) [@Shicong](https://discourse.slicer.org/u/Shicong)
#### Post date: [April 16, 2020, 7:16am UTC](https://discourse.slicer.org/t/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/11143/1 "2020-04-16T07:16:51Z")

</div>

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! !!! !!! !

 ![图片](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/6/e69bce08cf3ab5a78a9ba8bcb36205a7a6656fdd.png)  
 ![图片](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/b/4bc5080d1d2204a87e6949f6f7651b157ea9e3d8.png)

---

<div class="post-metadata">

### Author: ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://discourse.slicer.org/u/Mik)
#### Post date: [April 16, 2020, 11:23am UTC](https://discourse.slicer.org/t/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/11143/2 "2020-04-16T11:23:32Z")

</div>

Dear Zhao,

I think you can use [fileValue](http://www.commontk.org/docs/html/classctkDICOMDatabase.html#aa2d481e342ac960470bbb03a535e1d38) 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.

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [April 16, 2020, 12:40pm UTC](https://discourse.slicer.org/t/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/11143/3 "2020-04-16T12:40:43Z")

</div>

> [@Shicong](#):
>
> I get study description information in the c, the display is empty

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](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Subject_hierarchy)  
And these are the attribute names

> <https://github.com/Slicer/Slicer/blob/main/Libs/MRML/Core/vtkMRMLSubjectHierarchyConstants.h#L74-L124>

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

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [April 16, 2020, 1:46pm UTC](https://discourse.slicer.org/t/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/11143/4 "2020-04-16T13:46:12Z")

</div>

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:](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:)

---

<div class="post-metadata">

### Author: ![Shicong](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shicong/32/6562_2.png) [@Shicong](https://discourse.slicer.org/u/Shicong)
#### Post date: [April 17, 2020, 1:59am UTC](https://discourse.slicer.org/t/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/11143/5 "2020-04-17T01:59:08Z")

</div>

thank you, your help to me very much!

---

<div class="post-metadata">

### Author: ![Shicong](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shicong/32/6562_2.png) [@Shicong](https://discourse.slicer.org/u/Shicong)
#### Post date: [April 17, 2020, 2:10am UTC](https://discourse.slicer.org/t/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/11143/6 "2020-04-17T02:10:17Z")

</div>

thank you and give me the prompt message!

---

<div class="post-metadata">

### Author: ![Shicong](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shicong/32/6562_2.png) [@Shicong](https://discourse.slicer.org/u/Shicong)
#### Post date: [April 17, 2020, 2:36am UTC](https://discourse.slicer.org/t/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/11143/7 "2020-04-17T02:36:06Z")

</div>

Thank you for giving me great help!

---

<div class="post-metadata">

### Author: ![Shicong](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shicong/32/6562_2.png) [@Shicong](https://discourse.slicer.org/u/Shicong)
#### Post date: [April 28, 2020, 9:34am UTC](https://discourse.slicer.org/t/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/11143/8 "2020-04-28T09:34:31Z")

</div>

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 !

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [April 28, 2020, 4:18pm UTC](https://discourse.slicer.org/t/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/11143/9 "2020-04-28T16:18:36Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Shicong](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shicong/32/6562_2.png) [@Shicong](https://discourse.slicer.org/u/Shicong)
#### Post date: [April 29, 2020, 2:47am UTC](https://discourse.slicer.org/t/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/11143/10 "2020-04-29T02:47:07Z")

</div>

Thank you very much!

---

<div class="post-metadata">

### Author: ![apparrilla](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/apparrilla/32/9230_2.png) [@apparrilla](https://discourse.slicer.org/u/apparrilla)
#### Post date: [August 2, 2023, 7:48am UTC](https://discourse.slicer.org/t/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/11143/11 "2023-08-02T07:48:28Z")

</div>

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

> [Documentation/Nightly/ScriptRepository - Slicer Wiki](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:)

Could you update it?  
Thanks in advance!

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [August 4, 2023, 7:25pm UTC](https://discourse.slicer.org/t/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/11143/12 "2023-08-04T19:25:27Z")

</div>

The Slicer script repository was moved here a few years ago: [Script repository — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html)
