Skip to content

Commit 56c1dd3

Browse files
committed
Add a XA60 file, a test and documentation for PatientAgeDerived
1 parent ea15f21 commit 56c1dd3

File tree

5 files changed

+22
-7
lines changed

5 files changed

+22
-7
lines changed

docs/_static/dictionary-custom.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,19 @@ Nibabel2bids
7575
Oostenveld
7676
OpenMR
7777
P7
78-
Pt018
79-
Pt019
80-
PET2BIDS
78+
PatientAge
79+
PatientComments
8180
PatientName
8281
PatientSex
8382
Pawlik
84-
PatientComments
83+
PET2BIDS
8584
PerformedProcedureStepDescription
8685
Pet2bids
8786
Prepend
8887
ProtocolName
8988
PsychoPy
89+
Pt018
90+
Pt019
9091
PULS
9192
PyQt5
9293
Pydeface

docs/plugins.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You can use the ``bidscoin`` utility to list, install or uninstall BIDScoin plug
1212
Dcm2niix2bids: a plugin for DICOM and PAR/REC data
1313
--------------------------------------------------
1414

15-
The 'dcm2niix2bids' plugin is a wrapper around the well-known pydicom, nibabel and (in particular) `dcm2niix <https://github.com/rordenlab/dcm2niix>`__ tools to interact with and convert DICOM and Philips SPAR/REC source data. Pydicom is used to read DICOM attributes, nibabel is used to read PAR attribute values and dcm2niix is used to convert the DICOM and PAR/REC source data to NIfTI and create BIDS sidecar files. Personal data from the source header (e.g. Age, Sex) is added to the BIDS participants.tsv file. Please cite: `DOI: 10.1016/j.jneumeth.2016.03.001 <https://doi.org/10.1016/j.jneumeth.2016.03.001>`__
15+
The 'dcm2niix2bids' plugin is a wrapper around the well-known pydicom, nibabel and (in particular) `dcm2niix <https://github.com/rordenlab/dcm2niix>`__ tools to interact with and convert DICOM and Philips SPAR/REC source data. Pydicom is used to read DICOM attributes, nibabel is used to read PAR attribute values and dcm2niix is used to convert the DICOM and PAR/REC source data to NIfTI and create BIDS sidecar files. Personal data from the source header (e.g. Age, Sex) is added to the BIDS participants.tsv file. The plugin supports a custom tag ``PatientAgeDerived``, which computes age with high precision by taking the difference between ``AcquisitionDate`` and ``BirthDate``. Please cite: `DOI: 10.1016/j.jneumeth.2016.03.001 <https://doi.org/10.1016/j.jneumeth.2016.03.001>`__
1616

1717
Spec2nii2bids: a plugin for MR spectroscopy data
1818
------------------------------------------------

docs/troubleshooting.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ The bidscoiner says that the IntendedFor search gave no results
109109
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110110
Even if you have specified the IntendedFor value in the bidseditor, you still get `"Empty 'IntendedFor' field map value in {..}: the search for {..} gave no results"`. This may be because you hardcoded the IntendedFor value instead of providing a search pattern. Or it may be that you provided a correct search pattern but that for some subjects the target images were not acquired or could not be found (e.g. due to irregularities in the acquisition). Check out the BIDS output session(s) mentioned in the warning(s) and see if and how you should update your IntendedFor search pattern accordingly.
111111

112-
The bidscoiner says that I need to check my scan.tsv files
113-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
112+
The bidscoiner says that I need to check my scans.tsv files
113+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
114114
This may occur when you use a dynamic run-index (e.g. ``<<>>`` or ``<<1>>``) and the folder names of your DICOM Series do not start with the DICOM SeriesNumber (this is default on Siemens). The solution would be to rename your Series folder to alphabetical order (in many cases this can be done with ``disomsort``), or to use another dynamic value, e.g. ``<<SeriesNumber>>`` (the latter will yield properly ordered run-indices, albeit with a variable step, e.g. yielding ``run-2`` + ``run-5`` instead of ``run-1`` + ``run-2``
115115

116116
I use dynamic run-indices and now have 'orphan' run-indices in my BIDS directory
@@ -126,6 +126,10 @@ You can simply use the ``bidseditor`` to make changes to your bidsmap, delete al
126126
$ bidsmapper bidsfolder bidsfolder_new -p nibabel2bids -t bidsmap_bids2bids
127127
$ bidscoiner bidsfolder bidsfolder_new
128128
129+
I have set ``anon: n``, but I still get rounded "PatientAge" numbers
130+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
131+
In DICOM, ``PatientAge`` can be stored in `days, weeks, months or years <https://dicom.nema.org/dicom/2013/output/chtml/part05/sect_6.2.html>`__. So probably your ``PatientAge`` data was stored in years. To get a decimal age data, you can use the custom ``PatientAgeDerived`` tag from the `dcm2niix2bids plugin <./plugins.html#dcm2niix2bids>`__.
132+
129133
Irregular data acquisition
130134
--------------------------
131135

tests/test_bids.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ def dcm_file():
1818
return Path(get_testdata_file('MR_small.dcm'))
1919

2020

21+
@pytest.fixture(scope='module')
22+
def dcm_xa60_file(test_data):
23+
return Path(test_data/'XA60'/'00001_1.3.12.2.1107.5.2.43.66068.30000024121907551118800028571.IMA')
24+
25+
2126
@pytest.fixture(scope='module')
2227
def dicomdir():
2328
return Path(get_testdata_file('DICOMDIR'))
@@ -57,6 +62,11 @@ def test_attributes(self, datasource, extdatasource):
5762
assert datasource.attribute(r'PatientName:.*\^(.*?)1') == 'MR' # PatientName = 'CompressedSamples^MR1'
5863
assert extdatasource.attribute('PatientName') == 'ExtendedAttributesTest'
5964

65+
def test_age_derived(self, dcm_xa60_file):
66+
datasource = DataSource(dcm_xa60_file, {'dcm2niix2bids': Plugin({})}, 'DICOM')
67+
assert datasource.attribute('PatientAge') == '036Y'
68+
assert datasource.attribute('PatientAgeDerived') == '36.36139630390144'
69+
6070
@pytest.mark.parametrize('subid', ['sub-001', 'pat^visit'])
6171
@pytest.mark.parametrize('sesid', ['ses-01', 'visit^01', ''])
6272
@pytest.mark.parametrize('subprefix', ['sub-', 'pat^', '*'])
Binary file not shown.

0 commit comments

Comments
 (0)