I want to obtain the x, y coordinates of the regions I have segmented

I want to obtain the x, y coordinates of the regions I have segmented and the information on which section they are in. In what format should I save the segmentation and how can I get this coordinate information?

Storing a segmentation as a list of coordinates is an extremely inefficient representation. How would you use these coordinates?

True, but it would be easier to understand if inspecting ‘manually’, and also easier to write code to process.
—DIV

Indices are rarely useful for manual inspection, as even small structures consists of thousands of voxels (e.g., a tiny 10x10x10 structure = 1000 voxels), which is just too tedious to review manually. Image processing algorithms don’t operate on voxel indices representation, so I don’t see how it could help with any processing (unless you want to process your images with text processing algorithms?).

I did not want to tell @aysegul_sayin to just go and use numpy.where to get those indices, because most likely that would have lead to a dead end or suboptimal solution. Instead, I tried to understand what her overall goal was and find the best way to achieve that.

image

Hello, first of all thank you for your replies.
Actually, my goal is to reach the coordinate information of a segmented structure, for example a tumor. I’ve read and tried before on the forum that we can do this with the following code block. (I’m a bit of a newbie at Slicer so sorry if I said anything wrong). The values I got as numpy format from here were the values corresponding to the field that says Red.What do the values in the place called Red mean here? However, what I want is the x,y,z, coordinate information in my own MR image.

You can get voxels of a segmentation as a numpy array as shown in examples in the script repository.

“Red” means that the mouse pointer is over the “Red” view. You can ignore this information. Content displayed in the Data Probe is documented here.

What exactly do you need? Anatomical coordinates of the segmented tumor’s center?