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

Utility to fetch CSA headers from DICOM? #16

Open
matthew-brett opened this issue Apr 22, 2023 · 8 comments
Open

Utility to fetch CSA headers from DICOM? #16

matthew-brett opened this issue Apr 22, 2023 · 8 comments

Comments

@matthew-brett
Copy link
Contributor

matthew-brett commented Apr 22, 2023

Nibabel has a get_csa_header function : https://github.com/nipy/nibabel/blob/master/nibabel/nicom/csareader.py#L31

It implements the logic of finding the image or series CSA header from the DICOM file. I see from that file that there is logic for finding where the relevant private elements start: https://github.com/nipy/nibabel/blob/master/nibabel/nicom/utils.py#L7. . So, for example, instead of doing this:

raw_csa = dcm.get((0x29, 0x1020)).value
CsaHeader(raw_csa).read()

you can do this:

get_csa_header(dcm, 'image')
@matthew-brett
Copy link
Contributor Author

I guess that could be implemented as:

CSAHeader.from_dcm(dcm, 'image')

@ZviBaratz
Copy link
Contributor

Absolutely, that would be fantastic.

@matthew-brett
Copy link
Contributor Author

What repository should we use to hold the example DICOM files for testing?

@matthew-brett
Copy link
Contributor Author

E.g. for Nipraxis : https://github.com/nipraxis/nipraxis-data

@ZviBaratz
Copy link
Contributor

I think it would be ideal if we could leverage multiple download URLs to integrate data from dicom-gallery type repositories. WDYT?

@matthew-brett
Copy link
Contributor Author

Yup - looks to be trivial using the urls kwarg for Pooch : https://www.fatiando.org/pooch/v1.2.0/intermediate.html

@matthew-brett
Copy link
Contributor Author

I'll refactor the Nipraxis fetcher into its own mini-package. I've already refactored it so it uses a YaML config file to define its parameters. So we can probably just drop the package into csa_header, in a bit.

@matthew-brett
Copy link
Contributor Author

Refactored code into https://github.com/matthew-brett/unscrewed . Will add mini data repository and example fetches from the DICOM gallery tomorrow.

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

No branches or pull requests

2 participants