questions > Extracting dicom "header" information with -t option
Showing 1-3 of 3 posts
Results per page:
Jun 11, 2020  09:06 AM | chris hemond
Extracting dicom "header" information with -t option
Hello Chris and other DCM2niix experts,

I am trying to organize a large dataset for BIDS conversion, but in order to properly do so I need to extract the subject name and other information from the dicom header in order to match/assign proper (anonymized) identifiers.  The information I need is available from the "-t" option text file, but I don't want to convert everything to NIFTI just yet.  Is there a way to produce just a single informational text file without converting the whole dataset?  I've tried -n -1 option which works okay but is sometimes slow and I don't need the JSON files.  I'd prefer not to have to use Matlab or other scripts to read dicom headers if possible.

Thank you!
Jun 11, 2020  11:06 AM | Chris Rorden
RE: Extracting dicom "header" information with -t option

The text feature is very old - it pre-dates BIDS and should be considered deprecated. I would suggest you use the BIDS only option (-b o) without BIDS anonymization (-ba n) This will create JSON text file that is easy to parse. The JSON file will include personal information. The BIDS only option means only the JSON text files are created, not NIfTI images so this is very rapid:

dcm2niix -b o -ba n ~/neuro/pCASL2D/

json file...
"StudyID": "1",
"PatientName": "ASLDTIMONOtest",
"PatientID": "crlab",
"PatientBirthDate": "1969-01-01",
"PatientSex": "M",
"PatientWeight": 81.6466,
Jun 11, 2020  12:06 PM | chris hemond
RE: Extracting dicom "header" information with -t option
Perfect, thank you Chris!