aramis-lab/clinicadl

get-progression turns 2-digits session labels to 3 digits

Closed this issue · 1 comments

labels.tsv.zip
merged.tsv.zip

When I run

clinicadl tsvtools get-progression labels.tsv --time_horizon 36

and then

clinicadl tsvtools analysis merged.tsv labels.tsv analysis.tsv

I get the following error:

KeyError: ('sub-ADNI002S0685', 'ses-M048')

It comes from the fact that get-progression converts 2-digits session labels to 3-digits labels (e.g. ses-M48 to ses-M048) in labels.tsv, whereas they stay 2-digits labels in merged.tsv. To be more precise it is done by the function merged_tsv_reader called at the begining of get_progression.

def merged_tsv_reader(merged_tsv_path: Path):
if not merged_tsv_path.is_file():
raise ClinicaDLTSVError(f"{merged_tsv_path} file was not found. ")
bids_df = pd.read_csv(merged_tsv_path, sep="\t")
for i in bids_df.index:
session = bids_df["session_id"][i]
if len(session) == 7:
bids_df.loc[(i), "session_id"] = session[:5] + "0" + session[5:7]
return bids_df

So my question is: what is the purpose of converting 2-digits to 3-digits labels?

And a more general remark: shouldn't we switch the whole ClinicaDL to 3-digits labels to be consistent with Clinica? (see aramis-lab/clinicadl_handbook#23)

There is no problem if the labels.tsv and merged.tsv files already contain 3-digits labels, as they are outputted now by Clinica.