DIPY: Free water elimination package

Hello DIPY experts, https://dipy.org/documentation/1.0.0./examples_built/reconst_fwdti/# I am new to this field and helping out my team with applying the fwdti package on their images to remove possible free water effects. I think I have a fair understanding of the the overall flow of the code reconst_fwdti.py. I am facing some issues with taking the code that uses inbuilt demo data to work with mine. some of the suggestions that you have provided in this thread was helpful: :https://mail.python.org/archives/list/dipy@python.org/message/ILAINLGXNODPLV... But I have a couple of questions that am facing: 1. I would really appreciate some help with how I can supply my mask data instead of the median_otsu. 2. Also, we captured 50 axial slices. But when I assign axial_slices =50. File "C:\Users\sowsa\Documents\Python\reconst_fwdti.py", line 98, in <module> mask_roi[:, :, axial_slice] = mask[:, :, axial_slice] IndexError: index 50 is out of bounds for axis 2 with size 50 I am guessing this is because the demo data had an array limit to hold axial slices of 40. Any help to get past handling my own mask file is greatly appreciated ! TIA! ================ including the code I have so far below which shows the changes I have made to construct gtab etc. to supply the bvals and bvecs and the image data.======================================= import numpy as np import dipy.reconst.fwdti as fwdti import dipy.reconst.dti as dti import matplotlib.pyplot as plt from dipy.data import fetch_cenir_multib from dipy.data import read_cenir_multib from dipy.segment.mask import median_otsu import nibabel as nib from dipy.core.gradients import gradient_table img = nib.load(r"C:\Users\sowsa\Documents\Python\o01_ecc.nii.gz") import dipy.core.gradients as dpg gtab = dpg.gradient_table(r"C:\Users\sowsa\Documents\Python\fmri65_DTI_o01.bval", r"C:\Users\sowsa\Documents\Python\o01_ecc.nii.gz.eddy_rotated_bvecs") data = img.get_fdata() affine = img.affine """ The free water DTI model can take some minutes to process the full data set. Thus, we remove the background of the image to avoid unnecessary calculations. """ maskdata, mask = median_otsu(data, vol_idx=[0, 1], median_radius=4, numpass=2,autocrop=False, dilate=1) """ Moreover, for illustration purposes we process only an axial slice of the data. """ axial_slice = 40 mask_roi = np.zeros(data.shape[:-1], dtype=bool) mask_roi[:, :, axial_slice] = mask[:, :, axial_slice] """ The free water elimination model fit can then be initialized by instantiating a FreeWaterTensorModel class object: """ fwdtimodel = fwdti.FreeWaterTensorModel(gtab)
participants (1)
-
Sowmya.Sambamoorthy@utdallas.edu