dcmmeta2tsv¶
Give a tab separated metadata value line per dicom file.
Module Attributes
object that has obj.value for when a dicom tag does not exist using 'null' to match AFNI's dicom_hinfo |
Functions
|
|
|
extract parameters from siemens CSA :param csa: content of siemens private tag (0x0029, 0x1010) :return: [pepd, ipat] is phase encode positive direction and GRAPA iPATModeText |
|
read in tsv file like with header name,tag,desc. |
|
|
|
move our text files has tags like "0051,1017" to pydicom indexe like (0x51,0x1017) |
- dcmmeta2tsv.NULLVAL = <dcmmeta2tsv. object>[source]¶
object that has obj.value for when a dicom tag does not exist using ‘null’ to match AFNI’s dicom_hinfo
- dcmmeta2tsv.csa_fetch(csa_tr, item)[source]¶
>>> csa_fetch({'notags':'badinput'}, 'PhaseEncodingDirectionPositive') 'null'
- Parameters:
csa_tr (dict)
item (str)
- Return type:
str
- dcmmeta2tsv.read_csa(csa)[source]¶
extract parameters from siemens CSA :param csa: content of siemens private tag (0x0029, 0x1010) :return: [pepd, ipat] is phase encode positive direction and GRAPA iPATModeText
>>> read_csa(None) ['null', 'null']
- Return type:
list[str]
- dcmmeta2tsv.read_known_tags(tagfile='taglist.txt')[source]¶
read in tsv file like with header name,tag,desc. skip comments and header
- Parameters:
tagfile – text tsv file to get name,tag(hex pair),desc from
- Returns:
file parsed into a list of dictonaires
- Return type:
list[Tag]
- dcmmeta2tsv.read_tags(dcm_path, tags)[source]¶
- Parameters:
dcm_path (PathLike) – dicom file with headers to extract
tags (list[Tag]) – ordered dictionary with ‘tag’ key as hex pair, see
tagpair_to_hex()
- Returns:
list of tag values in same order as
tags
BUT with CSA headerspedp
,ipat
prepended- Return type:
list[str]
>>> tr = {'name': 'TR', 'tag': (0x0018,0x0080)} >>> read_tags('example_dicoms/RewardedAnti_good.dcm', [tr]) ['1', 'p2', '1300', 'example_dicoms/RewardedAnti_good.dcm']
>>> read_tags('example_dicoms/DNE.dcm', [tr]) ['null', 'null', 'null', 'example_dicoms/DNE.dcm']