This is related to my previous post regarding converting to ImagePlus, in that I’m still trying to get this flood fill algorithm working with the code provided to me. Given that the last conversation was quite helpful, I thought I’d try my luck again.
The issue I’m having is that IJ1 plugin that does the 3D flood filling, despite not throwing any errors, is not filling in a voxelized mesh of vasculature while the script is running.
# @Dataset input # @OpService opService # @DatasetService DatasetService # @UIService uiService # @OUTPUT Dataset volume_edt from ij import IJ from net.imglib2.img.display.imagej import ImageJFunctions as IJF from process3d import Flood_Fill iHeight = int(input.height) iWidth = int(input.width) iDepth = int(input.depth) thresholded = opService.convert().bit(input) # Compute our 3D mesh mesh = opService.geom().marchingCubes(thresholded) print("Mesh: ", mesh) # Voxelize the mesh and convert to ImagePlus object for use with IJ1 flood fill voxelization = opService.geom().voxelization(mesh, iHeight, iWidth, iDepth) voxelization = IJF.wrap(voxelization, "voxel_image") # Some coordinate that is interior to the mesh. This is hard coded, and generally needs to be manually determined per image. interior_coord = [132, 373, 5] ## Call IJ1 flood fill plugin ('process3d.Flood_Fill.fill', x-coord , y-coord, z-coord, fill color) ## fill_color = 255 Flood_Fill.fill(voxelization, interior_coord, interior_coord, interior_coord, fill_color) voxelization.show() ## More code using voxelization below ##
As a sanity check, I tried to use the 3D flood fill macro on a separate “sphere” mesh that I have saved, and it seems to work.
Essentially, my question is this - am I missing something blatantly obvious that would allow me to run the IJ1 plugin with this intermediate voxelization?
On a related note, I will then need to convert this filled voxelization back to a RandomAccessibleInterval containing the pixel values for use with other Ops further down the pipleine.
IJF.wrap() worked quite well for me last time, but I can’t seem to find an "“unwrap” method or anything similar in the documentation - is there an easy way to do this?
As with last time, I can provide more information if needed.