2424total_files = 0
2525
2626
27- def create_seqinfo (mw , series_files , series_id ):
27+ def create_seqinfo (mw , series_files , series_id , custom_seqinfo = None ):
2828 """Generate sequence info
2929
3030 Parameters
@@ -91,6 +91,9 @@ def create_seqinfo(mw, series_files, series_id):
9191 date = dcminfo .get ('AcquisitionDate' ),
9292 series_uid = dcminfo .get ('SeriesInstanceUID' ),
9393 time = dcminfo .get ('AcquisitionTime' ),
94+ custom =
95+ custom_seqinfo (wrapper = mw , series_files = series_files )
96+ if custom_seqinfo else None ,
9497 )
9598 return seqinfo
9699
@@ -138,7 +141,9 @@ def validate_dicom(fl, dcmfilter):
138141
139142def group_dicoms_into_seqinfos (files , grouping , file_filter = None ,
140143 dcmfilter = None , flatten = False ,
141- custom_grouping = None ):
144+ custom_grouping = None ,
145+ custom_seqinfo = None ,
146+ ):
142147 """Process list of dicoms and return seqinfo and file group
143148 `seqinfo` contains per-sequence extract of fields from DICOMs which
144149 will be later provided into heuristics to decide on filenames
@@ -159,9 +164,11 @@ def group_dicoms_into_seqinfos(files, grouping, file_filter=None,
159164 Creates a flattened `seqinfo` with corresponding DICOM files. True when
160165 invoked with `dicom_dir_template`.
161166 custom_grouping: str or callable, optional
162- grouping key defined within heuristic. Can be a string of a
163- DICOM attribute, or a method that handles more complex groupings.
164-
167+ grouping key defined within heuristic. Can be a string of a
168+ DICOM attribute, or a method that handles more complex groupings.
169+ custom_seqinfo: callable, optional
170+ A callable which will be provided MosaicWrapper giving possibility to
171+ extract any custom DICOM metadata of interest.
165172
166173 Returns
167174 -------
@@ -273,7 +280,8 @@ def group_dicoms_into_seqinfos(files, grouping, file_filter=None,
273280 else :
274281 # nothing to see here, just move on
275282 continue
276- seqinfo = create_seqinfo (mw , series_files , series_id )
283+
284+ seqinfo = create_seqinfo (mw , series_files , series_id , custom_seqinfo )
277285
278286 if per_studyUID :
279287 key = studyUID
0 commit comments