OpenChemistry / tomviz

Cross platform, open source application for the processing, visualization, and analysis of 3D tomography data
https://tomviz.org/
BSD 3-Clause "New" or "Revised" License
325 stars 87 forks source link

Exporting all orthogonal slices in order #1835

Open mnjalil opened 5 years ago

mnjalil commented 5 years ago

Is your feature request related to a problem? Please describe.

I am playing around with reconstructing micro CBCT projection images, where I have the angle data. Although not perfect, I have managed to reconstruct one where I can show volume and mesh. Naumann Stacked Sample 1 largest_0001

slice2

consurfmesh

Describe the solution you would like In order to make my own mesh outside tomviz, I would like to export all orthogonal slices that I have available to view after reconstruction. The second image in this post is an example of the view i would like to export for all slices.

Describe alternatives you have considered I might be missing something and this has a really easy solution, but I can only see the option of exporting a single slice or image. I thought i could exploit the animation feature but so far it has really confused me and seems to save multiple copies of the same view ( this may be entirely due to my lack of understanding). I also considered a custom script, but i am not confident in my understanding and ability to implementing that change. Additional context I understand that this software may not have been built specifically for micro cbct projections, but I thought since the concepts and algorithm are similar, I could try it.

cryos commented 5 years ago

So you would like to export every slice in a volume? If you have a 200 x 300 x 400 volume you might get 400 images that are 200 x 300. Is that correct? We save as multi-page TIFFs which may accomplish some of what you want.

mnjalil commented 5 years ago

Yes, that sounds about right. Could you please elaborate on how this would be achieved?

cryos commented 5 years ago

I don't think we have a way to do that at present, i.e. export all slices separately. Most people don't want to do that. You could use a Python utility, I think something like imagesplit might help there if you were to save out a volume as a TIFF.

ercius commented 5 years ago

It seems to me that you want to export all slices orthogonal to a certain viewing direction rather than either the X, Y or Z directions. This requires an iterated resampling of the data using interpolation, and is not available by default on tomviz.

I wrote a script to do this in python using VTK (the base viz package underlying tomviz). My script could be used for your data, but it would have to be done outside tomviz currently.

mnjalil commented 5 years ago

Thank you for your responses. I have a temporary solution for my issue. I export the volume from tomviz, opening it in image j and then saving it as an image sequence, which seems to work.

cryos commented 5 years ago

Sounds good, but to clarify @mnjalil you just want to export a sequence of flat 2D images moving through the volume in x, y, or z directions? I think @ercius is talking about something more general where it would be nice to see what you are doing, I guess setting a direction and then iterating along it using something like our slice filter to interpolate?

mnjalil commented 5 years ago

I am not sure what details you are asking for, but this is what I did. I found this just from trial and error, but I created a volume as shown in the third image in my original post. I right clicked on the volume from the pipeline in tomviz, and exported as an EMD format. This file can then be imported into image j as an HDF5 file type. Once open, this file can be saved as an image sequence, which then can be imported into any ct reconstruction software, thresholded (or region of interest selection) and then turned into a 3D model. I used image j to get the following output:

Capture

The output isn't the best, and some data is lost around the edges (which is probably because of the low-density material), but it's a good start something.