DICOMS

heudiconv.dicoms.compress_dicoms(dicom_list, out_prefix, tempdirs, overwrite)

Archives DICOMs into a tarball

Also tries to do it reproducibly, so takes the date for files and target tarball based on the series time (within the first file)

dicom_list : list of str
list of dicom files
out_prefix : str
output path prefix, including the portion of the output file name before .dicom.tgz suffix
tempdirs : object
TempDirs object to handle multiple tmpdirs
overwrite : bool
Overwrite existing tarfiles
filename : str
Result tarball
heudiconv.dicoms.embed_metadata_from_dicoms(bids, item_dicoms, outname, outname_bids, prov_file, scaninfo, tempdirs, with_prov, min_meta)

Enhance sidecar information file with more information from DICOMs

bids item_dicoms outname outname_bids prov_file scaninfo tempdirs with_prov min_meta

heudiconv.dicoms.embed_nifti(dcmfiles, niftifile, infofile, bids_info, min_meta)

If niftifile doesn’t exist, it gets created out of the dcmfiles stack, and json representation of its meta_ext is returned (bug since should return both niftifile and infofile?)

if niftifile exists, its affine’s orientation information is used while establishing new NiftiImage out of dicom stack and together with bids_info (if provided) is dumped into json infofile

dcmfiles niftifile infofile bids_info min_meta

niftifile, infofile

heudiconv.dicoms.get_dicom_series_time(dicom_list)

Get time in seconds since epoch from dicom series date and time Primarily to be used for reproducible time stamping

heudiconv.dicoms.group_dicoms_into_seqinfos(files, file_filter, dcmfilter, grouping)

Process list of dicoms and return seqinfo and file group seqinfo contains per-sequence extract of fields from DICOMs which will be later provided into heuristics to decide on filenames Parameters ———- files : list of str

List of files to consider
file_filter : callable, optional
Applied to each item of filenames. Should return True if file needs to be kept, False otherwise.
dcmfilter : callable, optional
If called on dcm_data and returns True, it is used to set series_id
grouping : {‘studyUID’, ‘accession_number’, None}, optional
what to group by: studyUID or accession_number
seqinfo : list of list
seqinfo is a list of info entries per each sequence (some entry there defines a key for filegrp)
filegrp : dict
filegrp is a dictionary with files groupped per each sequence
heudiconv.dicoms.parse_private_csa_header(dcm_data, public_attr, private_attr, default=None)

Parses CSA header in cases where value is not defined publicly

dcm_data : pydicom Dataset object
DICOM metadata
public_attr : string
non-private DICOM attribute
private_attr : string
private DICOM attribute
default (optional)
default value if private_attr not found
val (default: empty string)
private attribute value or default