Maximum intensity projection

Hi all,

I am running the following command to get a 3D mask but the output is 4D. I know it is because the input image is 4D but I don’t know how to modify my code to basically do a maximum intensity projection or condensing the 4D image into a 3D one.

mrcalc dwi_denoised_unringed_preproc_upsampled.mif 0 -lt -datatype bit - | mrthreshold - -invert - | mrcalc - dwi_mask_upsampled.mif -mul dwi_mask_upsampled_corrected.mif 

dwi_denoised_unringed_preproc_upsampled.mif is a 4D DWI.
dwi_mask_upsampled.mif is a 3D mask created by dwi2mask.
dwi_mask_upsampled_corrected.mif is the output that I want to be 3D and essentially is same as dwi_mask_upsampled.mif but the with problematic pixels are turned to zero.

Any idea how to do this?

Try this:

mrcalc dwi_denoised_unringed_preproc_upsampled.mif 0 -ge -datatype bit - | mrmath - max -axis 3 - | mrcalc - dwi_mask_upsampled.mif -mul dwi_mask_upsampled_corrected.mif
1 Like