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

tsv files not saved #30

Closed
xiangruili opened this issue Mar 10, 2020 · 7 comments
Closed

tsv files not saved #30

xiangruili opened this issue Mar 10, 2020 · 7 comments

Comments

@xiangruili
Copy link
Owner

xiangruili commented Mar 10, 2020

Copied From Matlab Central
@tanguyduval Any idea for this?


Dear Xiangrui,
I used dicm2nii and related functions outside gui to convert dicom files for 1 anatomical series to bids for subject x, all goes well, but I invariably get:
Warning: Could not save sub-subjx_sessions.tsv
Warning: Could not save participants.tsv

what is to be done? How can I use dcm2nii so that all output (json, tsv) is saved? (Only the nii.gz file is saved, no warning re json, but no json file saved either)
Thank you,
OL

@tanguyduval
Copy link
Contributor

Concerning the json files that are not saved, I guess the user did not check the option in the GUI.
Concerning the tsv file, I will push a commit to catch the error tomorrow. Currently I only send a warning.. He could try to check if the function write_tsv.m is working correctly by running the example: write_tsv('Pierre','stats.tsv','age',50)

Best
Tanguy

@octlie
Copy link

octlie commented Mar 11, 2020

Dear Xiangrui,, my files are aquired on a Phillips scanner, please let me know if you need additional info.

  1. As to the json, if one does not use the gui, how can one call json writing when converting dicoms with dicm2nii?
  2. Tanguy, the write_tsv test worked, but I continue getting the warning when running dicm2nii with my files, thank you. Please let me know when you updated the write_tsv to catch the error
    Thank you both,
    OL

@tanguyduval
Copy link
Contributor

Hi @octlie

  1. to save json. Run once and for all setpref('dicm2nii_gui_para', 'save_json', true). Then, anytime you run dicm2nii you'll have the json files saved.
  2. Ok, I let you know.

Best
Tanguy

@tanguyduval
Copy link
Contributor

Hi @octlie,

error catch has been added in 1ab08d2
You can now try again after download the last version: https://github.com/xiangruili/dicm2nii/archive/master.zip

Best,
Tanguy

@octlie
Copy link

octlie commented Mar 29, 2020

Dear All,

Thank you for the code update! When trying the latest version, I do not get any warnings, and the tsv files (and json, after running setpref('dicm2nii_gui_para', 'save_json', true), as advised) are written.

However, when checking the bids folder with the bids validator https://bids-standard.github.io/bids-validator/ , I invariably get the same 4(1) error(s) and 2 warnings, whether I use named or anonymized (through anonymize_dicm.m) dicom files.

When I run dicm on a dicom folder X (say <fullpath = fullfile(basepath, parentdir, X);>) for bids conversion, I get a bids folder XX (say <fullpath = fullfile(basepath, parentdir, XX);>) and a TSV file 'participants.tsv' with the same path ( (say <fullpath = fullfile(basepath, parentdir, 'participants.tsv' );>) . If I upload the folder XX into the validator, I get 4 errors, if I upload parentdir, I get 1.
So it seems that dicm should generate, for one, a parentdir Y containing subfolder XX and 'participants.tsv' (the reason is that the native parentdir containing the folder X may have other files, and uploading it may generate as such, additional errors; it is also a matter of cleanliness- keeping bids data separate from non-bids data); this reduces errors to 1 (and 2 warnings) :

view 1 error
Error 1: [Code 57] DATASET_DESCRIPTION_JSON_MISSING
Click here for more information about this issue
The compulsory file /dataset_description.json is missing. See Section 03 (Modality agnostic files) of the BIDS specification.
view 2 warnings in 2 files
Warning 1: [Code 82] CUSTOM_COLUMN_WITHOUT_DESCRIPTION
Click here for more information about this issue
Tabular file contains custom columns not described in a data dictionary2 files
Warning 2: [Code 101] README_FILE_MISSING
Click here for more information about this issue
The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification.
Regarding the error, there is a json file included in the folder XX, so I have not idea why it throws the error (there must be an additional json file generated?).

About how to go about this timely, I think the best way is for me to upload the input dicom files (anonymized, T1w) in a zip folder and see if you could take a shot at it (run dicm then validate with bids validator).

Thank you very much, I appreciate your help (and promptness!).
Octavian

0155_anonymized.zip

@tanguyduval
Copy link
Contributor

@octlie thank you for sharing your experience and data,

We recommend to use an empty output folder, separated from dicoms, for bids conversion. Generally:

INPUT= '.../data/dicoms';
OUTPUT= '.../data/bids';
dicm2nii(INPUT, OUTPUT, 'bids')

The results is:

OUTPUT: 
                  .../data/bids/participants.tsv
                  .../data/bids/sub-001/sub-001_sessions.tsv
                  .../data/bids/sub-001/ses-01/anat/sub-001_ses-01_T1w.nii.gz
                  .../data/bids/sub-001/ses-01/anat/sub-001_ses-01_T1w.json

Then you have to manually create others mandatory bids files (see the bids specs):

                  .../data/bids/dataset_description.json
                  .../data/bids/README

These are not created automatically by dicm2nii

Warning 1 is not very relevant here, don't pay attention to it. It says that you can describe the columns name of the .tsv files (e.g. Age) in a separate file.

Note that you can add new subjects to the same bids folder:

INPUT= '.../OTHER_SUBJECT/dicoms';
OUTPUT= '.../data/bids';
dicm2nii(INPUT, OUTPUT, 'bids')

Best,
Tanguy

@octlie
Copy link

octlie commented Mar 30, 2020

Thank you for your prompt answer, that clarifies it! OL

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

3 participants