I’m wanting to break down a . STL file to a stack of voxel images so that I can use ImageJ functions for 3d image analysis. Is there a plugin available?
LimeSeg - a particle active contour method for 3D segmentation
Unable to convert stl to stacks
[Edit]: the suggestion below does not work as stated for loaded STL files as indicated by @iarganda
it should be possible with the 3D Viewer. You can load .STL files into the 3D Viewer via the ►File menu. Then you can still apply transformations to the object and export it to a stack via ►Edit ►Transformation ►Export transformed image. The result will the 3D stack.
Hello @biovoxxel, I don’t think you can do that unless there is an underlying grayscale image. I just tried it out and got an error:
Sorry for the incorrect indication. You are right. I obviously had the input stack open ando forgot that the STL file actually only comprises the surface and does not have the intensity info available.
So just forget about my earlier suggestion.
We added voxelization to imagej-ops a bit ago: http://javadoc.scijava.org/ImageJ/index.html?net/imagej/ops/geom/geom3d/DefaultVoxelization3D.html
I don’t know much about coding. Do you have a compressed .jar file so that I can just drop it into the plugins folder and have it work?
Almost! Or rather: there is almost a working ImageJ update site.
We added a page about voxelization to the ImageJ wiki awhile ago. However, those instructions are now outdated. The “ThreeDViewer” is now known as SciView. Much time and effort is being expended by @kephale and @skalarproduktraum and myself to get it to a usable state. One of its features is voxelization of meshes.
We are in the middle of a hackathon this week madly working on this stuff. So please stay tuned; hopefully we will have something for you to try soon.
Looking forward to it. Thanks!
Do we have any update from the December Hackathon? Is the a stable combination of plugins that can Voxelize an .stl today?
Not stable. But experimental, yes: you can enable the SciView update site to give it a try as described here (that documentation still says “ThreeDViewer” but the instructions are probably OK otherwise? @kephale?)
Note that the SciView update site is intentionally not on the built-in list of update sites yet, because it is not yet stable enough. But you can use the “Add update site” button to add it manually.
There will be another hackathon in late April specifically dedicated to SciView—the development continues!
Actually, to help tease apart graphics and mesh processing dependencies I added a STL voxelization script to FunImageJ.
Just enable the FunImageJ update site (it is in the standard update site list), then access the command via the menu at: Plugins>FunImageJ>Mesh>voxelize mesh. It asks for a STL file and voxel dimensions as input.
Note that voxelization is not a trivial problem, and if you get an unexpected result, then please contact me and I will look into it. There are a couple of folks who are joining me to dive a bit further into some fancier voxelization algorithms in the near future (coinciding with the SciView hackathon).
I tried to load a simple stl of 12MB, no luck. tried other files, the same error, which I’m posting below. Any help welcome:
[ERROR] null java.util.NoSuchElementException, compiling:(NO_SOURCE_FILE:0:0) at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3657) at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3651) at clojure.lang.Compiler$DefExpr.eval(Compiler.java:451) at clojure.lang.Compiler.eval(Compiler.java:6932) at clojure.lang.Compiler.eval(Compiler.java:6890) at org.scijava.plugins.scripting.clojure.ClojureScriptEngine.eval(ClojureScriptEngine.java:88) at org.scijava.plugins.scripting.clojure.ClojureScriptEngine.eval(ClojureScriptEngine.java:63) at org.scijava.script.ScriptModule.run(ScriptModule.java:160) at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168) at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127) at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66) at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.util.NoSuchElementException at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:713) at java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:734) at net.imagej.ops.geom.geom3d.DefaultVoxelization3D.calculate(DefaultVoxelization3D.java:90) at net.imagej.ops.geom.geom3d.DefaultVoxelization3D.calculate(DefaultVoxelization3D.java:65) at net.imagej.ops.special.function.UnaryFunctionOp.run(UnaryFunctionOp.java:74) at net.imagej.ops.special.function.AbstractUnaryFunctionOp.run(AbstractUnaryFunctionOp.java:58) at org.scijava.command.CommandModule.run(CommandModule.java:199) at net.imagej.ops.OpEnvironment.run(OpEnvironment.java:938) at net.imagej.ops.OpEnvironment.run(OpEnvironment.java:134) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93) at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28) at fun.imagej.ops$run_op.invokeStatic(ops.clj:129) at fun.imagej.ops$run_op.invoke(ops.clj:125) at clojure.lang.AFn.applyToHelper(AFn.java:156) at clojure.lang.AFn.applyTo(AFn.java:144) at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3652) ... 15 more [ERROR] null
Can you post one of the stl’s as an example? I just tried and it still seems to work for me.
Hi, I would love to try the stl to voxel converter but I’ve been trying hi and lo to find the plugin and instructions on how to install it.
Sorry to be such a noob but really I can’t google myself out of this with +35 years of programming experience … this must be simple but no can do.
The easiest way at the moment is:
- Install the SciView update site. It is available in the list of update sites and should be a checkbox in your Fiji updater.
- Open SciView
- Open your STL in SciView
- In the SciView menu: Process > Mesh to Image
Alternatively, for programmatic access you can explore imagej-ops, and you will find it listed in the
geom namespace as
voxelization. You will need to use imagej-mesh to open the STL.
I use SciView and mesh to image.
but my results have no mesh on the edges. i.e. my edges are not close.
Is that fixable by imagej or other processing?