I should mention too that this isn’t exactly the code used in the paper - some of the authors worked on this as a way to generalize the scripts used for the paper.
At this point there haven’t been a lot of prints made, so the best mapping between volume rendering and printer files is a bit of an open question (input welcome).
This looks awesome! I tried to install it as an extension via Slicer’s Application Settings–>Extension Wizard but it seems to not be working… All that I have to do is add the path to the BitmapGenerator folder (in the SlicerFab-master folder cloned from GitHub) to the “Additional template paths for modules” section? It should then show up as a module in Slicer, yes?
Right - this is not in the Extension manager yet, but the structure is compatible, so if we confirm it works well and maybe add some tweaks to the UI it would be easy to migrate it (this would make it easier to install).
You can either put the path on the command line as in the README of the repository or you can add it to the Edit->Application Settings dialog by clicking the Add button shown below and browsing to the BitmapGenerator folder and then restarting.
Again, thank you for pointing out these modules. Being close by I’d love to come up and talk to you about this in person.
My question now pertains to using this module to export png’s in color for the j750. My contact at grabcad sent me this in response to the png’s SlicerFab created:
Right - the SlicerFab module just puts out the continuous tone color files, but they need to be further process for the printer using the dithering technique described in the paper.
The script for dithering is in this ipython notebook file but doesn’t run automatically. This allows you to get full color in the print even with a small number of colors in the printer (just like an ink just printer can print color images with only 4 ink cartridges).
Integrating the dithering step into the module directly is another task we haven’t had a chance to do yet, which is another reason SlicerFab is not a regular Slicer extension yet.
Just want to say thanks to you guys, this module help me a lot, easy to use.
I am new to slicer, if anyone like me having problem using it, here is what I did
I am on V4.8.1
goto edit → app setting
in modules, add the folder where the py code it. restart the app, it should show up in the modules drop down
once you got the volume rendering setup, open the BitmapGenerator, setup where the folder is, click on “Apply”.
I need the image to to be transparent , but I don’t know much about python,
so here is my python code to remove the white background.
( maybe someone can update the module’s scode. )
import os
rootdir = '/temp/'
extensions = ('.png')
from PIL import Image
for subdir, dirs, files in os.walk(rootdir):
for file in files:
ext = os.path.splitext(file)[-1].lower()
if ext in extensions:
print (os.path.join(subdir, file))
img = Image.open(file)
img = img.convert("RGBA")
datas = img.getdata()
newData = []
for item in datas:
if item[0] == 255 and item[1] == 255 and item[2] == 255:
newData.append((255, 255, 255, 0))
else:
newData.append(item)
img.putdata(newData)
img.save("t_"+file, "PNG")
continue
else:
continue
Good point @lassoan, I added this as an extension. The extension was generated a while ago but the format should still be good (it builds for me). We can see what it looks like in the morning.
People should feel free to track issues on the github repository. I don’t have easy access to the right printer, so it would be great of people who do could help improve the code.
The SlicerFab extension needed a couple tweaks, but a working extension should be available tomorrow in the extension manager. It could still use work exposing some of the slicing parameters to the in the GUI but it should be workable.
Does anyone have experience getting the png’s from slicerfab to print at the proper resolutions for a J750? Typically the y -res is 600 the x-res is 300. Currently I do not see an option in the python to modify the resolutions…
If anyone wants to give this a try, it should be simple to switch to the Qt writer in the code below. Then if it works it would be great to expose this in the GUI.
You need to be at 600dpi in the X and 300dpi in the Y for the connex500 printer. Z resolution is at 30um or 0.03mm. Essentially you need the X to be stretched twice as much as the Y. Make sure to do the stretching before the dither, otherwise your bits are not square anymore. Also make sure the X pixels are divisible by 16. crop slightly if needed. Y can be anything. Here is a document from Stratasys that explains this further.
Hey. There seems to be some bugs with the latest SlicerFab. I keep getting a stack of the same image repeated. Its not actually slicing the model anymore. The image is a top down view. How can I fix this?
I was able to use the BitmapGenerator yesterday to create a .PNG image stack from a rendered volume by just simply hitting “Apply”. I’m using 3D Slicer 4.11.0 (Nightly Build).
I’ve tried today with Slicer-4.10 and it works well for me, too.
Do you see the image changing on your screen?
How large is your volume? (slab spacing is set to 0.5mm; if your volume is very large or very small then you might not see much change in the exported images)
Is the voxel spacing set in mm? (it is, if you imported from DICOM)