Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Allows the user to save the Phoenix Report in the sourcedata folder #489

Merged
merged 2 commits into from
Jan 13, 2021

Conversation

pvelasco
Copy link
Contributor

@pvelasco pvelasco commented Jan 8, 2021

This PR allows the user to store the Phoenix Report in the sourcedata folder.

Siemens scanners create a Phoenix Report (or Phoenix Document) series, with DICOM files that store the protocol that was run on a given scanner session. These Phoenix Report series can be brought back into any Siemens scanner that runs the same software version and be used to automatically import the protocol parameters.

By archiving the Phoenix Report in the sourcedata, the user can extract it, load it back into the scanner and run the exact same protocol that was run for a previous subject, improving reproducibility. This can be done by going to the image database in the scanner, "importing" the Phoenix Report and then drag-and-dropping it into the exam queue

This PR includes the code (in dicoms.py), unittest (test_dicoms.py) with the corresponding test data (tests/data/Phoenix) and an example of heuristic (bids_PhoenixReport.py, with the corresponding unittest in test_heuristics.py)

…cedata

This way the user can go back to the scanner and import the exact same protocol that was run for a given subject, improving reproducibility.
@codecov
Copy link

codecov bot commented Jan 8, 2021

Codecov Report

Merging #489 (fe3fc34) into master (d8e5c5f) will increase coverage by 0.41%.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #489      +/-   ##
==========================================
+ Coverage   76.01%   76.42%   +0.41%     
==========================================
  Files          38       39       +1     
  Lines        3010     3042      +32     
==========================================
+ Hits         2288     2325      +37     
+ Misses        722      717       -5     
Impacted Files Coverage Δ
heudiconv/dicoms.py 82.11% <66.66%> (+0.96%) ⬆️
heudiconv/heuristics/bids_PhoenixReport.py 93.33% <93.33%> (ø)
heudiconv/tests/test_dicoms.py 100.00% <100.00%> (ø)
heudiconv/tests/test_heuristics.py 100.00% <100.00%> (ø)
heudiconv/convert.py 86.50% <0.00%> (+1.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d8e5c5f...fe3fc34. Read the comment docs.

Copy link
Member

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Pushed just minor tune up. Will merge if all is still good

BTW -- what to "eat" that dicom with later on? never used those types of files.

parse_private_csa_header,
embed_dicom_and_nifti_metadata,
group_dicoms_into_seqinfos,
OrderedDict,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while at it -- please sort alphabetically (I usually just do that in pycharm)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can import those files back at the scanner (or at a different scanner, for that matter), as if they were a normal image. Those "images" will then show up in the image browser, as if it was a normal subject/session.
It is useful because you can then register a new patient at the scanner and "drag-and-drop" these fake images into the scanner queue and voila, you would have the protocol imported "automagically".

This is a very nice trick of Siemens: if somebody shared some DICOM images with you, you could import them into your own scanner and get the same protocol imported, without the need for somebody to export the protocol for you, etc. This process was called to "Phoenix" some images. One (big) problem with that was those DICOM files contained protected health info (the images themselves) together with the name, DoB, etc. Plus people would share a lot of files (say, one per slice, for an anatomical image) when you only needed the protocol info, which is in the header of each of the DICOM files.

Siemens solved this problem by creating that Phoenix Report, which contains just one DICOM file per run with the protocol information, without any pixel values, making it very portable. Furthermore, because it was a DICOM file, you could send it to your PACS system for storage. Then, if you wanted to replicate a study (e.g., for a clinical follow up), you just needed to import back at the scanner the Phoenix Report, rather than the whole set of images.

We use it as a backup (in the sourcedata folder) of the actual protocol, in case you need to share it and for whatever reason you don't have access to the original protocol (so exporting an exar1 file or a pdf is not an option).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can import those files back at the scanner (or at a different scanner, for that matter), as if they were a normal image. Those "images" will then show up in the image browser, as if it was a normal subject/session.

so there is one Phoenix .dcm file per each sequence in any given study (which typically has multiple sequences)? or in other words -- could we associate a Phoenix .dcm file with a specific produced sequence (and thus .nii.gz wherever there is a single nii produced)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. It depends on what you call "sequence".

There will be one .dcm file per run (here, I call "run" each of the entires in the scanner queue). Some runs produce more than one series (I call "series" each of the folders containing images in the scanner image browser; each "series" has a different seriesUID).

Some Phoenix .dcm files will produce one series (e.g., an MPRAGE without intensity normalization), while other produce more than one series (e.g., a CMRR GRE EPI with a multiband factor larger than 1 will produce the _SBRef series plus the actual MB series). Finally, to make things more interesting, some series can generate more than one .nii.gz file: for the GRE fieldmap, one single run (which will have a single Phoenix .dcm corresponding to it) will have two series (of DICOM images): one for the magnitude images and another for the phase difference images. The series with the phase difference images will produce a single .nii.gz file, while the series with the magnitude will produce two .nii.gz images, one per echo.

If a given "run" is repeated multiple times, there will be multiple (identical, except for the run number) Phoenix .dcm files.

So, in the end, yes: if you have a .nii.gz, there will be a Phoenix .dcm file with the protocol that was used to generate that image. But several .nii.gz images can come from the same Phoenix .dcm file.

But, because there might be more .nii.gz images than Phoenix .dcm files, you need to be careful how to assign which one to which. Probably the best way would be to look at the ID Image Time in the Phoenix .dcm file to check that it matches (at least closely) the ID Image Time of the DICOM series from which the .nii.gz was generated.

(Not sure if all that makes sense...)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Unlike in case of dicoms+nii produced from them, association might indeed be tricky and anyways is for a heuristic to figure out

@yarikoptic yarikoptic merged commit 599cb83 into nipy:master Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants