Operating system:Windows 10 Pro
Hello. I did a quick google search but nothing showed up so I was wondering if you could help me.
I am very familiar with thresholding/segmenting/exporting as stl’s, etc… I work as a 3d Printing Lab Coordinator at a hospital.
However I’m fortunate enough to have a printer that can print voxel by voxel and theoretically have MUCH more detail than traditional 3d printers (in 500,000+ colors). In order to print at the voxel level I need to provide a stack of .png’s to the software. Obviously my first thought was to take the dicom images and convert to png in batch and provide that, but I’d rather not just have black and white prints. So I thought it’d be cool if the volume rendering options in 3d slicer that provide color volumes could then be exported (with their colors) as a stack of png’s. Possible? How do I do it?
You may record a video from your VR model using Screen Capture module, then export each frame to PNG images. It should be possible to modify the ffmpeg video creation options so that the source PNG files are not deleted during video creation, but I don’t know what other option to pass to ffmpeg. Or I completely missed your point.
I’d have to try it but I’m not 100% sure thats it. What I’m looking for is really just like a png that is a colorized version of each dicom image. I know there are dicom-> png converters (which i’ve used) but then I’m left with black and white png’s. I want pngs that have color and transparency added in a similar manner to what the volume render did. I can then send that stack of png’s to my printer.
I’m assuming pngs from the video would be more like a frame by frame screenshot from one viewpoint? Right?
Thank you. I had kind of assumed it wasn’t in slicer yet but I wanted to double check. I know just enough programming in R to be dangerous and I think I’ll tinker with creating my own converter for dicom-> png with added color. We’ll see if I’m in over my head.
@lassoan it’s the one described in the paper - it acts just like an inkjet printer where you can choose what to deposit at each point (mix of primitive colors CMYK plus clear and maybe others like something to control the stiffness of the material). There’s dithering in the driver to map the continuous tone of the input images to essentially bitmap (on/off) at high resolution of the printer. So these sliced PNGs essentially go right into the printer driver. That’s why the main module is called the BitmapGenerator.
By the way, it would be great if anyone wants to enhance this SlicerFab code. There are more parameters like slab thickness and spacing, output image resolution, and other things that could easily be added to the interface if needed.
I just installed it and used it to generate png’s. Prior to sending to the printer I should double check layer height. The j750 I use has a 0.027mm thickness between layers, and I know the one in your paper was listed at 0.030. Does the BitmapGenerator module automatically reslice to create this 0.030 thickness?
If you know the values you want, I’d suggest changing them in the code and then restarting slicer. If you find yourself experimenting, you can enable Developer Mode in Slicer (se Edit->Application Settings -> Developer) and you’ll get a Reload button so you can change the code on the fly.
Longer term, as I mentioned, it would be good to expose these in the user interface, possibly with presets for any commonly used printers.
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.
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. )
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 == 255 and item == 255 and item == 255:
newData.append((255, 255, 255, 0))