Is there a way to get the dicom slice index number of the slice which contains the ROI?

Hello, I am working with 3D Dicom images. I would like to get the index of the slices which contains the liver region (ROI) as some slices do not show liver or full black. Is it possible to do it in sitk?

Hello @DushiFdo,

Yes it is possible to get the indexes:

label_shape_filter = sitk.LabelShapeStatisticsImageFilter()
# The bounding box's first three entries are the starting index and last three entries the size
bounding_box = label_shape_filter.GetBoundingBox(roi_value)
start_z_index = bounding_box[2]
end_z_index = bounding_box[2] + bounding_box[5]
1 Like