smriprep
smriprep copied to clipboard
Multi-session datasets with multiple lesion masks
Our current workflow seems to assume that when there's a lesion mask, there's only one T1w image and only one mask. In Neurostars #3776, where there are multiple sessions with anatomicals and masks, this results in an illegal list of lesion masks being passed to t1_2_mni
.
mri_robust_register
(used under the hood of mri_robust_template
) was actually designed for the case of tumors [1], where the changing size would wreak havoc with cost functions. (The solution was to identify outlier voxels and exclude them from the cost function.)
So as long as the template looks reasonable, then the appropriate thing to do is to apply the transforms from each of the input T1w images to their corresponding lesion masks, and take the union of the masks.
Do we currently produce a figure for the report showing the lesion mask overlay? If we're going to do any manipulation of the masks, I think this will be an important addition.
@danlurie Your thoughts on this would be very appreciated.
Just want to make sure I understand the situation before answering, which of the following situations are we considering?
- There are multiple sessions, and each session has its own T1w and lesion mask.
- There are multiple sessions, each session has its own T1w but there is only a single lesion mask.
- Both 1 and 2.
- Something else.
Also, am I following correctly that multi-session T1w images are handled by registering them together; is that correct? Then the question is how best to transform the lesion masks from each session to the co-registered T1w images?
I believe it's case 1, at least for what we're seeing. If there were multiple T1s and only one lesion mask, that would itself be potentially problematic if the first session (ordered lexically) were not the one with the mask, then alignment might be broken.
Also, am I following correctly that multi-session T1w images are handled by registering them together; is that correct?
Yes, we create a template by coregistering all of the T1w images and taking the median. Typically aligned to the first image (ordered lexically).
Then the question is how best to transform the lesion masks from each session to the co-registered T1w images?
So it's just coregistering to a single template, and the transform from each original image to the template is produced by the template creation step. So we would then be able to pair each transform to the associated mask and easily get a series of masks in the template space.
My thought then is to take the union of all of these. I would assume that, if a voxel is marked bad in one of the T1w images, then it should be bad in the final template.
Is it possible to process T1w in different session separately? In our case, different between session was more than a year or more for the same subject, same protocol, same parameter and same machines.
They can be preprocessed entirely separately, but I believe at the moment fMRIPrep can't simply select one session and ignore the others. If that's what you want, I think it makes sense to prioritize re-enabling --session <label>
options, at which point you would run a separate instance of fMRIPrep for each session.
This would mean, though, that there's no correspondence between the T1w
space for each session. Only the MNI space derivatives would be in register with each other. There are some open questions on the best way to handle longitudinal data, and we'd appreciate any input on what people expect/want in those cases.
In any event, are you working with the poster from NeuroStars (Peter Goodin)? If so, then fixing the session selection would probably be a better short term goal than working out the correct integration of lesion masks from multiple sessions.
Oh, I think Peter is on Github. cc @petergoodin
In my experience, given the difficulty of drawing/generating masks, multiple masks (i.e. one mask for each session) will only exist in cases where the masked area is different between sections, such as when doing a longitudinal study of stroke recovery. Given such a scenario, we would not want to take a union of the masks, but rather just accept that there will be some deformation when registering to the common T1w template.
If there were multiple T1s and only one lesion mask, that would itself be potentially problematic if the first session (ordered lexically) were not the one with the mask, then alignment might be broken.
I expect this issue will come up at some point for datasets where there are multiple sessions but only a single mask (e.g. because the pathology is stable and does not change over the period of the study). How to handle this may be more of a BIDS question (e.g. Do we require a mask in each session directory?)
Hi, Just to confirm: the pathology is stable over scans and the mask was drawn from the first session lesion then co-registered to subsequent session.
Okay. I think in this particular case, as long as you're happy using the template, then removing the extra lesion masks might be sufficient to resolve your issue. I would run first with --anat-only
, to make sure that the lesion mask does align to the final template (do not use --longitudinal
).
Awesome, thanks for the work around!
Ah, and just to be clear:
I would run first with
--anat-only
, to make sure that the lesion mask does align to the final template
--anat-only
will not fix the mask. It just avoids spending time on functionals before you've had a chance to verify the mask. You'll still want to manually load the preprocessed T1w and the original ROI mask to check.
And actually, I'd add --output-space T1w
, which prevents T1w-MNI normalization. If your mask is not aligned, that will likely add on a bunch of time.
Same problem occurs in fmriprep
. Is it still possible to solve this problem?
@276562578 In general, no we do not have a method for using multiple lesion masks. If your use case matches Peter's, then you can delete duplicate lesion masks. If not, please describe your use case in detail (a listing of the subject directory and description of the masks would be needed).
It's very appreciate!
I also want to confirm again, pter's case means multiple ses share one lesion mask, so do I just keep the lesion_roi
in ses-1
and delete the lesion_roi
in other ses
, or do I put the same lesion_roi
file in each ses
?
Thanks again!
By the way
For my case, the lesion mask varies greatly between each ses
(different recovery periods for stroke patients), should it be more reasonable to preprocess each ses
independently?
Or does it depend on my study to use the same lesion mask for multiple ses
if it does not involve the location of the max size initial injury, or to preprocess independently If the study involves the difference parts
( difference parts = the largest first lesion mask - the smaller second lesion mask )
.
Another strange thing, I had a successful run in qsiprep with different lesion masks in each ses, I don't know how qsiprep handles this case
there are my bids folder
bids/sub-L001/
├── ses-1
│ ├── anat
│ │ ├── sub-L001_ses-1_T1w.json
│ │ ├── sub-L001_ses-1_T1w_label-lesion_roi.nii.gz
│ │ ├── sub-L001_ses-1_T1w.nii.gz
│ │ ├── sub-L001_ses-1_T2w.json
│ │ └── sub-L001_ses-1_T2w.nii.gz
│ ├── dwi
│ │ ├── sub-L001_ses-1_dwi.bval
│ │ ├── sub-L001_ses-1_dwi.bvec
│ │ ├── sub-L001_ses-1_dwi.json
│ │ └── sub-L001_ses-1_dwi.nii.gz
│ └── func
│ ├── sub-L001_ses-1_task-rest_bold.json
│ └── sub-L001_ses-1_task-rest_bold.nii.gz
├── ses-2
│ ├── anat
│ │ ├── sub-L001_ses-2_T1w.json
│ │ ├── sub-L001_ses-2_T1w_label-lesion_roi.nii.gz
│ │ ├── sub-L001_ses-2_T1w.nii.gz
│ │ ├── sub-L001_ses-2_T2w.json
│ │ └── sub-L001_ses-2_T2w.nii.gz
│ ├── dwi
│ │ ├── sub-L001_ses-2_dwi.bval
│ │ ├── sub-L001_ses-2_dwi.bvec
│ │ ├── sub-L001_ses-2_dwi.json
│ │ └── sub-L001_ses-2_dwi.nii.gz
│ └── func
│ ├── sub-L001_ses-2_task-rest_bold.json
│ └── sub-L001_ses-2_task-rest_bold.nii.gz
└── ses-3
├── anat
│ ├── sub-L001_ses-3_T1w.json
│ ├── sub-L001_ses-3_T1w_label-lesion_roi.nii.gz
│ ├── sub-L001_ses-3_T1w.nii.gz
│ ├── sub-L001_ses-3_T2w.json
│ └── sub-L001_ses-3_T2w.nii.gz
├── dwi
│ ├── sub-L001_ses-3_dwi.bval
│ ├── sub-L001_ses-3_dwi.bvec
│ ├── sub-L001_ses-3_dwi.json
│ └── sub-L001_ses-3_dwi.nii.gz
└── func
├── sub-L001_ses-3_task-rest_bold.json
└── sub-L001_ses-3_task-rest_bold.nii.gz
the 3 lesion is different, and I change the bids like below, failed
bids/sub-L001/
├── ses-1
│ ├── anat
│ │ ├── sub-L001_ses-1_T1w.json
│ │ ├── sub-L001_ses-1_T1w_label-lesion_roi.nii.gz
│ │ ├── sub-L001_ses-1_T1w.nii.gz
│ │ ├── sub-L001_ses-1_T2w.json
│ │ └── sub-L001_ses-1_T2w.nii.gz
│ ├── dwi
│ │ ├── sub-L001_ses-1_dwi.bval
│ │ ├── sub-L001_ses-1_dwi.bvec
│ │ ├── sub-L001_ses-1_dwi.json
│ │ └── sub-L001_ses-1_dwi.nii.gz
│ └── func
│ ├── sub-L001_ses-1_task-rest_bold.json
│ └── sub-L001_ses-1_task-rest_bold.nii.gz
├── ses-2
│ ├── anat
│ │ ├── sub-L001_ses-2_T1w.json
│ │ ├── sub-L001_ses-2_T1w.nii.gz
│ │ ├── sub-L001_ses-2_T2w.json
│ │ └── sub-L001_ses-2_T2w.nii.gz
│ ├── dwi
│ │ ├── sub-L001_ses-2_dwi.bval
│ │ ├── sub-L001_ses-2_dwi.bvec
│ │ ├── sub-L001_ses-2_dwi.json
│ │ └── sub-L001_ses-2_dwi.nii.gz
│ └── func
│ ├── sub-L001_ses-2_task-rest_bold.json
│ └── sub-L001_ses-2_task-rest_bold.nii.gz
└── ses-3
├── anat
│ ├── sub-L001_ses-3_T1w.json
│ ├── sub-L001_ses-3_T1w.nii.gz
│ ├── sub-L001_ses-3_T2w.json
│ └── sub-L001_ses-3_T2w.nii.gz
├── dwi
│ ├── sub-L001_ses-3_dwi.bval
│ ├── sub-L001_ses-3_dwi.bvec
│ ├── sub-L001_ses-3_dwi.json
│ └── sub-L001_ses-3_dwi.nii.gz
└── func
├── sub-L001_ses-3_task-rest_bold.json
└── sub-L001_ses-3_task-rest_bold.nii.gz
Even I copy sub-L001_ses-1_T1w_label-lesion_roi.nii.gz
and name sub-L001_ses-2_T1w_label-lesion_roi.nii.gz
sub-L001_ses-3_T1w_label-lesion_roi.nii.gz
, failed again.
May be the only way I can do is like this?
bids
├── dataset_description.json
│── sub-L0011
│ ├── ses-1
│── sub-L0012
│ ├── ses-2
│── sub-L0013
│ ├── ses-3