I have two different modality images . CT and PET whole body. For each of them I want to crop the images in x and y dimension such that the background black pixels are removed. I want to get rid of black space outside the image . I cannot find a suitable function for the 3D image .Also the image type is float32. I have tried otsu’s thresholding based cropping but I suppose that only works for uint8. Is there any function or a small example would be helpful.