How to plot [x,y,z] coordinates on the 3D viewer?

Is there a way to plot coordinates from a csv file onto a 3d image in the imageJ 3d viewer?

I have a 3d image that I have loaded into the 3D viewer and it is displaying the image without any problems. The image is a binary volume containing spheres at certain locations. I have the [x,y,z] coordinates of the spheres in a csv file and would like to draw the coordinates ontop of the image to see how accurate the coordinates are as compared to the original image.

I imagined Landmarks>>Load point list was for this purpose but when I load in my csv file I get the message:

There was a points file, but this line was malformed:
252,467,7
There was a points file, but this line was malformed:
212,426,7
There was a points file, but this line was malformed:
211,474,7
There was a points file, but this line was malformed:
214,459,5
There was a points file, but this line was malformed:
215,390,0

Some guidance on how to achieve this would be appreciated.

Thank you

1 Like

This message suggests that the file you are providing is not in the format it expects. I would suggest you add a few random points and then save the list so you can compare the format and make the necessary adjustments.

Hi @farazk86,

why not simply make an empty (black) stack with the same dimensions as your 3D image and simply draw the points in the stack as single pixels using the coordinates.
This should be managable fairly quickly using a macro or script.
This 3D point image can then be added to the 3D viewer to see the point location in space.

Farazk86,
While the image is in 3D viewer the Edit function allows you to show the coordinates on the image. Then go from there.
Bob

Thanks for replying. I cant see any way to add points to the image, I’ve tried all menu items and nothing would let me add points onto the 3d volume in the 3d viewer.

Sorry but I’m really new to ImageJ/FIJI, how would I go about creating an empty 3d stack and then add pixel coordinates to it?

Thank you

Thanks for replying. I enabled the show coordinate system in Edit but all it did was show the x, y and z vector directions in the 3d viewer and according to the suggested coordinates my loaded in points list are in the correct order.

Hello farazk86,
Yes and every slice is a step in the z-plane.
Good luck!
Bob

Thanks but that does not solve my initial issue of how to load the points file onto the 3d viewer. or how to visualize said points

I figured it out. The points file must be in the format:

"point1": [ 467, 252, 7 ]
"point2": [ 426, 212, 7 ]
"point3": [ 474, 211, 7 ]
"point4": [ 459, 214, 5 ]
"point5": [ 390, 215, 0 ]

and it should be saved with the extension .points

The documentation does not mention this anywhere, it would be helpful if its mentioned that normal csv files are not supported

2 Likes

Hello farazk86,
Very good work. I agree that it should be mentioned on how to use csv in macros and plugins
Bob

1 Like

Well, in this case, it isn’t a CSV; strictly speaking.

trans to image stack is not the best way, (waste time and memory), the best way is plot use the data directly.

1 Like

I add a plugin in ImagePy moment ago.

We can open an excel/csv, or use ImagePy to generate some random data.
we can select x,y,z series, set a number or series as r, set color or set a series with color map.

you can have a try, this is ImagePy’s macros:

Gaussian Random>{'row': 15, 'col': 5, 'mean': 10, 'std': 3}
Table Point Cloud>{'x': 0, 'y': 1, 'z': 2, 'r': 0.1, 'rs': 3, 'c': (0, 0, 255), 'cs': 3, 'cm': '16_Colors', 'cube': True}

Thanks for you inspiration,It is very useful, That is a k-means demo, very bueatiful:


For modern ImageJ visualization, x,y,z point clouds are supported by default in SciView.

See the following script that creates and displays a XYZ file

Just for clarification, isn’t ImagePy separate from Fiji?

Good day Andrew,

as the author writes here:

ImagePy is a open source software use the experience of ImageJ. But it is a pure python implementation. https://github.com/Image-Py/imagepy

I conclude that you are right but maybe that 3D-viewing is more convenient than with Fiji. I don’t know.

Regards

Herbie

Yeah, I read that which is why I thought it was separate. I just thought that, since a solution to the problem was reasonably possible in Fiji, it seemed a bit odd to suggest just switching to an entirely different program.

Fully agreed!

Herbie