hope you are doing well. I’m still new to sct software and excited to use it as a main tool to analyse my Ex-vivo dwi dataset.
I wonder how I may solve the following issue to align dwi dataset with T1 mask orientation (RPI)?
T1 dataset and (DWI) were scanned in the sme space. So,I resampled the dwi dataset to T1 resol. Then I tried to re-orient my dwi data to RPI orientation to use T1 mask to generate dwi template but unfortunately it didn’t seem to work out.
I followed the following steps:
I used the following commands for T1 dwi dataset to get RPI orientation that matches the mask. Please see screenshots when I tried to overlay the dwi and t1 dataset with Charleys’ mask (nothing were changed). sct_image -i dwi_top_resampled.nii.gz -setorient RPI dwi_top_resampled_RPI.nii.gz
Just checking in to see how I can help. Would you like to send me 1-2 images so I can check on my end how to tune the registration? You can send it to me via email if the data cannot be publicly disclosed.
I did share dataset via email. Let me know please if further information is needed.
The link didn’t work-- see my email.
by the way, I wonder whether SCT tools could handle to straighten 4D dwi dataset or not.
To straighten a 4D volume, you can first estimate the curve2straight warping field using a 3D data, and then apply it to the 4D volume. Below is an example code:
# Download example data
sct_download_data -d sct_example_data
# Go to DWI folder
# Separate b=0 and DWI and average
sct_dmri_separate_b0_and_dwi -i dmri.nii.gz -bvec bvecs.txt
# Segment cord
sct_deepseg_sc -i dmri_dwi_mean.nii.gz -c dwi
# Straighten DWI mean data
sct_straighten_spinalcord -i dmri_dwi_mean.nii.gz -s dmri_dwi_mean_seg.nii.gz
# Apply straightening to 4D dmri data
sct_apply_transfo -i dmri.nii.gz -d straight_ref.nii.gz -w warp_curve2straight.nii.gz
Thank you very much @jcohenadad. It’s very robust method and is working very well now.
In regard to the dataset, a link has been sent to your email. Let me know please if there is any issues while downloading.
I had a look at the images you sent me. First of all, I noticed that 4225_top_sc.nii.gz is not the segmentation of 4225_top_1.nii but of another image. In order to register your DWI scans to 4225_top_sc.nii.gz, I would also need the image that this mask is based on.
Also, I noticed that the two masks are flipped A-P:
Thank you very much for your valuable information. I re-sent all data via email including T1 that belongs to the mask you had already. Could you please also re-produce -setorient RPI and sct_deepseg/straightening as well from your side?
I tested these options but results did not look good.
sct_image -setorient only alters the qform/sform of the header, not the actual data. In your case, the header is inconsistent with the data orientation, so you need to enforce another orientation between your data and the header-- this is done using the setorient-data flag. See below (red: before, green: after):
I ran this:
sct_image -i 4225_top_sc.nii.gz -setorient-data RAI -o 4225_top_sc_RAI.nii.gz
Now I am wondering why the mask had a wrong orientation at the first place. You mentioned it is “Charley’s mask”: but how was it produced? What command?
There are also problems with the file 4225_top_1.nii: some fields which are wrong, e.g. pixdim0:
size of header 348
pixdim0 0.000000 --> WRONG VALUE