Skip to content

Instantly share code, notes, and snippets.

@dscho dscho/gist:243555
Created Nov 26, 2009

Embed
What would you like to do?
from ij.plugin import Duplicator
from ij3d import *
from java.awt import Font, Frame, Color
from javax.media.j3d import Transform3D
from voltex.Mask import BlendMethod, BlendSource
image = IJ.openImage("/home/iarganda/Desktop/Main_Page_files/Stitching-overview.jpg")
mirror = Duplicator().run(image, 1, image.getStackSize())
#mp = mirror.getProcessor().resize(1437, 200);
w = image.getWidth()
h = image.getHeight()
mp2 = ColorProcessor(1437, 200)
mp2.setRoi(Roi(0, 150, 1437, 50))
mp2.setValue(-1)
mp2.fill()
mp2.resetRoi()
GaussianBlur().blur(mp2, 50)
'''
mp.copyBits(mp2, 0, 0, Blitter.ADD)
mp.setFont(Font("SansSerif", Font.BOLD, 60))
mp.setAntialiasedText(1)
mp.setColor(Color.GRAY)
mp.drawString("Fiji Is Just ImageJ - Batteries Included", 100, 190)
mp.setColor(Color.BLACK)
mp.drawString("Fiji Is Just ImageJ - Batteries Included", 97, 187)
mirror = ImagePlus("mirror", mp)
'''
mask = IJ.createImage("mask", "8-bit white", w, h, 1)
ip = mask.getProcessor()
ip.setValue(0)
ip.fill()
ip.setValue(64)
ip.drawRect(0, 0, w - 1, h - 1)
ip.setValue(128)
ip.drawRect(1, 1, w - 2, h - 2)
#mask.show()
univ = Image3DUniverse()
univ.show()
univ.getCanvas().getBG().setColor(0xe9, 0xe9, 0xe9)
c1 = univ.addOrthoslice(image, None, "image", 0, [1, 1, 1], 1)
#c1 = univ.addVoltex(image)
#Thread.sleep(1000)
m = c1.getContent().setMask(mask)
print m.getColorSource(0), m.getColorSource(1), m.getColorMethod(), m.getAlphaSource(0), m.getAlphaSource(1), m.getAlphaMethod()
m.setColorSource(0, BlendSource.TEXTURE)
m.setColorMethod(BlendMethod.REPLACE)
m.setAlphaSource(0, BlendSource.MASK)
print m.getColorSource(0), m.getColorSource(1), m.getColorMethod(), m.getAlphaSource(0), m.getAlphaSource(1), m.getAlphaMethod()
#c1.getContent().createMask()
#c2 = univ.addOrthoslice(mirror, None, "mirror", 0, [1, 1, 1], 1)
#Thread.sleep(1000)
c1.setTransform(Transform3D([0.9746335, -0.2210424, 0.035067406, -95.92581, 0.14518073, 0.7436706, 0.65259224, -166.48909, -0.17032915, -0.6309472, 0.7568974, 392.53455, 0.0, 0.0, 0.0, 1.0]))
c1.applyTransform(Transform3D([1.3, 0, 0, 0, 0, 1.3, 0, 0, 0, 0, 1.3, 0, 0, 0, 0, 1]))
'''
c2.setTransform(Transform3D([1.0, 0.0, 0.0, -310.31796, 0.0, 1.0, 0.0, 692.1285, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]))
c2.applyTransform(Transform3D([1.3, 0, 0, 0, 0, 1.3, 0, 0, 0, 0, 1.3, 0, 0, 0, 0, 1]))
univ.getWindow().setExtendedState(Frame.MAXIMIZED_BOTH)
Thread.sleep(1000)
univ.getWindow().updateImagePlus()
univ.takeSnapshot().show()
# univ.close();
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.