Which input file format for 3D data?

bonej
Tags: #<Tag:0x00007fd546893488>

#1

Hi all, I’m a PhD candidate in Forest ecology working on 3D forest models.
I’m interested in using BoneJ for my research (identification and classification of branches on the ground) but I can’t find info on the image specifications in order to provide a suitable file to ImageJ.
I tried to export my data from R as a multi-layered binary raster (tiff, grd, envi) but none of the provided files (8 to 64bit) worked. I saw that Nifty-1 format can be read with a plugin but at the moment I’m still unable to produce them from R.
Any other suggestion?
thank you in advance for any help!

Niccolò


#2

Hi, Niccolò.

Can you give more information on how your data looks like? Regarding your issue on the format, I am affraid I cannot give you suggestions, but I can say that depending on how your data looks like it is possible that other plugin might be more suitable.

  • Is your data in 2D or 3D?
  • Does the data looks like a network of filaments?
  • If yes, are the tree branches connected with other branches starting from a single point in the ground or more than one point in the ground (I assume a single point, but I am not sure).
  • If yes, is this network highly branched?

Depending on your answers there might be other options of plugins and approaches to quantify what you want.

cheers,


#3

hi Leandro, thanks for the reply!

  1. my original data (collected with a terrestrial laser scanner) are distributed in a 3D space;
  2. no, they are single points with x,y,z, coordinates, a pretty dense point cloud (~1pt/mm2) but still not a network;
  3. branches can be lying on the ground and “spread” upward, or just hanging from outside my study plot (1x1m)
  4. branches might be highly connected but this can be seen only with a voxel approach, useful for the connectivity analysis that I want to perform;

My idea is to transform them into a multi-layered binary image (a Nifti-1?) to represent the presence/absence of data at a certain height and then use BoneJ to create and analyse the 3D structure.


#5

So, I assume you have a .txt file with a lot of rows and 3 columns indicating [x,y,z] positions of the objects you are interested in.

In that case, (and also if no one else answers and suggest a better and simpler solution), you can write a macro in ImageJ or use other software to construct a binary image from your point cloud data. You will basically compute a tri-dimensional matrix or a bunch of two dimensional matrices and compute 1 to the voxel with [x,y,z] coordinates if these coordinates are present in your point cloud.

Below is a rough step by step instruction on how you can do that (other people in the forum may suggest better ways of doing it or provide more details on how to write the code):

(lets assume you chose n x n x n matrix)

  1. Create a n x n x n matrix (1000 x 1000 x 1000 if the resolution is 1 mm as you stated) filles with zeros or n times n x n matrices with elements filled with zeros
  2. in a for loop starting from the initial row of your point cloud to the last row of your point cloud (cont=1 or 0 to nrows) Here a link that has a similar example with a simple macro implementation from NIH ImageJ forum.
  3. within the loop the position in the matrix of
    [pointcloud[cont,column 1],pointcloud[cont,column 2],[cont,pointcloud[column 3]]] coordinates receives the value of 1.
  4. depending on where you do that, you may have another text file or a binary matrix
  5. If you have a text file, ImageJ is capable of reading if and turn it into an image. If you have a matrix and if you happened to work with matlab there is a way to communicate with ImageJ through ImageJ -Matlab scripting. I am not sure if it is possible to create an image from a three-dimensional matrix in a macro in ImageJ, but it is probably doable as well.

In that case, when you obtain your image, I suppose it is good to use BoneJ (I have never used it but I checked their website) because it also uses Analyze Skeleton and Skeletonize 3D. However, if your image has a lot of undesired objects that happened to be detected along with your filament network, you may need to remove them using Analyse particles or other methods.

Another issue you may face will occur if your point cloud provides only surface data and not points that lie within the surface. In that case, you can probably use the close operation (located in Process>Binary>Close).

I may have some time in the next days to help you with some macro, but let’s see If someone else answers with more insights.

By the way: not sure, but this topic may be better classified as Image analysis.

Cheers,


#6

great, I see that we agree on the procedure!
the only odd point right now (and that’s why I prefer to keep it as ‘issue’) is still the data format to use.
I’ll try to play a bit with the array I have and understand how to prepare the data in txt format. Thanks for the hint!


#7

Hello @spono,

For what you want to achieve, the suggestions of @leandroscholz are very good.
If you really want to have a “standard” file format for point cloud (that can include information such as color, connectivity and so on), you can have a look at the ply file format.

There should be a support for this format in SciView, the next ImageJ 3D viewer that should be available in a near future (I don’t know exactly where is the project currently… but @skalarproduktraum and @kephale can tell).

Aside from ImageJ, matlab supports it (https://ch.mathworks.com/help/vision/ref/pcread.html), as well as other software such as cloud compare (thanks @daniel.sage for this discovery).

Best of luck with your project!


#8

These all seem like good suggestions. BoneJ itself doesn’t know much about file formats - it assumes that the input data are already opened as an image in ImageJ.

To do a network analysis in BoneJ binary pixels are thinned into a medial axis representation and this is analysed to give branches and nodes; lately @alessandrofelder and @rimadoma have been working on adapting this to measure angles between branches and node valence. To do this you will need a pipeline to go from your surface points to solid branches, represented as binary 3D pixels, which the above suggestions might help you with. There may be better ways to do this analysis given the input data, which are 2.5D surface points I guess, where BoneJ expects 3D data that include the ‘insides’ of the object (e.g. from X-ray microtomography).


#9

@NicoKiaru : I already have my data in a standard format (.las) typical for laser data acquisitions and used in CloudCompare.

@mdoube: so, only for clarification: it’s not a matter of file format, ImageJ/BoneJ will voxelise the pixels between one layer and the other of the picture I provide, correct? Sorry for the noob question but it’s my first attempt with 3D imagery.
What does the ‘inside’ of the objects (voxel?) consist of? which kind of information?

btw, many THANKS to all of you for the great contribution and availability:now I have quite a lot to play with!


#10

@spono: I will try to clarify what @mdoube explained. I might have written something superficial as well, but I also pointed out this potential issue (I think we were talking about the same thing).

Commonly, the information in a point cloud only shows the surface of the object. In other words, it might be the case that, when you compute a binarized image from your point cloud data you will see something like this (I’m not sure how your data looks like, you can use matlab to plot your point cloud and see how it looks like, using function pcshow)

detection

But, since you are interested in knowing the skeleton structure and the connectivity your your filaments, the voxels that are within the circle in white also require to have white values (1 or 255 or whatever maximum value depending on the image format). For this reason the pixels within the circle needs to be altered in some way (that is why I pointed out the use of the morphological operation close) so you would see something like this:

detection2

So, let`s say you simply used Skeletonize and Analize skeleton processes to obtain the medial axis of your strucutres. In the end you would have:

taggedskeleton

If you used the first circle, Skeletonize process wouldn`t work.

Let us know what you end up doing. I am curious about it. I have worked with point clouds in the past but not enough to be an expert at it.

Cheers,


#11

Hi @leandroscholz @mdoube , i currently came across some issues about inputting 3D image into bonej. Basically, i tried to analyse the .STL file which was output from FEA software Abaqus. i could open it in 3D viewer, but can not do any further measurements.
Do I need to convert this STL into images stacks? Any suggestions would be very helpful, I appreciate all your helps.

Juan


#12

BoneJ is not set up to analyse STLs directly. You will need to convert the STL to a binary stack first.