public static Content createContent(final String name, final ImagePlus[] images, final int type, final int resf, int tp, final Color3f color, final int thresh, final boolean[] channels) { final TreeMap<Integer, ContentInstant> instants = new TreeMap<Integer, ContentInstant>(); final boolean timelapse = images.length > 1; final boolean shouldSwap = SWAP_TIMELAPSE_DATA && timelapse; for (final ImagePlus imp : images) { final ContentInstant content = new ContentInstant(name); content.image = imp; content.color = color; content.threshold = thresh; content.channels = channels; content.resamplingF = resf; content.timepoint = tp; content .showCoordinateSystem(UniverseSettings.showLocalCoordinateSystemsByDefault); content.displayAs(type); content.compile(); if (shouldSwap) { content.clearOriginalData(); content.swapDisplayedData(); } instants.put(tp++, content); } return new Content(name, instants, shouldSwap); }
public static Content createContent(final CustomMultiMesh node, final String name, final int tp) { final Content c = new Content(name, tp); final ContentInstant content = c.getInstant(tp); content.color = null; content.transparency = 0f; content.shaded = true; content .showCoordinateSystem(UniverseSettings.showLocalCoordinateSystemsByDefault); content.display(node); return c; }
/** * @deprecated * @param p */ @Deprecated public void addPointListPoint(final Point3d p) { getCurrent().addPointListPoint(p); }
final ContentInstant c = new ContentInstant(props.get("name")); if ((tmp = props.get("channels")) != null) { sp = tmp.split("%%%"); if ((tmp = props.get("rotation")) != null) c.getLocalRotate().setTransform( t(tmp)); if ((tmp = props.get("translation")) != null) c.getLocalTranslate() .setTransform(t(tmp)); final int type = i(props.get("type")); if (c.image == null) throw new RuntimeException("Cannot load image: " + props.get("imgfile")); c.displayAs(type); if (type == ContentConstants.SURFACE_PLOT2D && (tmp = props.get("surfplt")) != null) ((SurfacePlotGroup) c.getContent()).setSlice(i(tmp)); final OrthoGroup og = (OrthoGroup) c.getContent(); sp = tmp.split("%%%"); c.display(createCustomNode(tmp)); if ((tmp = props.get("color")) != null) c.setColor(new Color3f(new Color( i(tmp)))); if ((tmp = props.get("transparency")) != null) c.setTransparency(f(tmp)); if ((tmp = props.get("threshold")) != null) c.setThreshold(i(tmp)); if ((tmp = props.get("shaded")) != null) c.setShaded(b(tmp)); if ((tmp = props.get("visible")) != null) c.setVisible(b(tmp));
private Content makeTrackContent() { // Prepare tracks instant trackNode = new TrackDisplayNode( model ); universe.addTimelapseListener( trackNode ); // Pass tracks instant to all instants final TreeMap< Integer, ContentInstant > instants = new TreeMap< >(); final ContentInstant trackCI = new ContentInstant( "Tracks_all_frames" ); trackCI.display( trackNode ); instants.put( 0, trackCI ); final Content tc = new Content( TRACK_CONTENT_NAME, instants ); tc.setShowAllTimepoints( true ); tc.showCoordinateSystem( false ); return tc; }
public void display(final ContentNode node) { for (final ContentInstant c : contents.values()) c.display(node); }
public Content(final String name, final int tp) { this.name = name; this.swapTimelapseData = false; setCapability(BranchGroup.ALLOW_DETACH); setCapability(Node.ENABLE_PICK_REPORTING); timepointToSwitchIndex = new HashMap<Integer, Integer>(); contents = new TreeMap<Integer, ContentInstant>(); final ContentInstant ci = new ContentInstant(name + "_#" + tp); ci.timepoint = tp; contents.put(tp, ci); timepointToSwitchIndex.put(tp, 0); contentSwitch = new Switch(); contentSwitch.setCapability(Switch.ALLOW_SWITCH_WRITE); contentSwitch.setCapability(Group.ALLOW_CHILDREN_WRITE); contentSwitch.setCapability(Group.ALLOW_CHILDREN_EXTEND); contentSwitch.addChild(ci); addChild(contentSwitch); }
public ContentInstant(final String name) { // create BranchGroup for this image this.name = name; setCapability(BranchGroup.ALLOW_DETACH); setCapability(Node.ENABLE_PICK_REPORTING); // create transformation for pickeing localTranslate = new TransformGroup(); localTranslate.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); localTranslate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); addChild(localTranslate); localRotate = new TransformGroup(); localRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); localRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); localTranslate.addChild(localRotate); ordered = new OrderedGroup(); for (int i = 0; i < 5; i++) { final Switch s = new Switch(); s.setCapability(Switch.ALLOW_SWITCH_WRITE); s.setCapability(Switch.ALLOW_SWITCH_READ); s.setCapability(Group.ALLOW_CHILDREN_WRITE); s.setCapability(Group.ALLOW_CHILDREN_EXTEND); ordered.addChild(s); } localRotate.addChild(ordered); // create the point list points = new PointList(); plShape = new PointListShape(points); plShape.setPickable(true); plPanel = new PointListPanel(name, points); }
public void applyTransform(final Transform3D transform) { for (final ContentInstant c : contents.values()) c.applyTransform(transform); }
public void applySurfaceColors(final ImagePlus img) { for (final ContentInstant c : contents.values()) c.applySurfaceColors(img); }
@Override public void contentRemoved(final Content c) { for (final ContentInstant co : contents.values()) { co.contentRemoved(c); } }
private Content makeTrackContent() { // Prepare tracks instant trackNode = new TrackDisplayNode( model ); universe.addTimelapseListener( trackNode ); // Pass tracks instant to all instants final TreeMap< Integer, ContentInstant > instants = new TreeMap< >(); final ContentInstant trackCI = new ContentInstant( "Tracks_all_frames" ); trackCI.display( trackNode ); instants.put( 0, trackCI ); final Content tc = new Content( TRACK_CONTENT_NAME, instants ); tc.setShowAllTimepoints( true ); tc.showCoordinateSystem( false ); return tc; }
public void displayAs(final int type) { if (image == null) return; // create content node and add it to the switch switch (type) { case VOLUME: contentNode = new VoltexGroup(this); break; case ORTHO: contentNode = new OrthoGroup(this); break; case SURFACE: contentNode = new MeshGroup(this); break; case SURFACE_PLOT2D: contentNode = new SurfacePlotGroup(this); break; case MULTIORTHO: contentNode = new MultiOrthoGroup(this); break; default: throw new IllegalArgumentException( "Specified type is neither VOLUME, ORTHO," + "SURFACE or SURFACEPLOT2D"); } display(contentNode); // update type this.type = type; }
public void applyTransform(final double[] matrix) { applyTransform(new Transform3D(matrix)); }
public void applySurfaceColors(final Content c) { if (!checkSel(c)) return; final int t = c.getType(); if (t != ContentConstants.SURFACE && t != ContentConstants.CUSTOM) return; final GenericDialog gd = new GenericDialog("Apply color from image"); final int[] ids = WindowManager.getIDList(); final String[] titles = new String[ids.length]; for (int i = 0; i < ids.length; i++) titles[i] = WindowManager.getImage(ids[i]).getTitle(); gd.addChoice("Color image", titles, titles[0]); gd.addCheckbox("Apply to all timepoints", true); gd.showDialog(); if (gd.wasCanceled()) return; final ImagePlus colorImage = WindowManager.getImage(gd.getNextChoice()); if (gd.getNextBoolean()) c.applySurfaceColors(colorImage); else if (c.getCurrent() != null) c.getCurrent().applySurfaceColors( colorImage); }
final ContentInstant contentThisFrame = new ContentInstant( "Spots_frame_" + frame ); contentThisFrame.display( blobGroup );
public static Content createContent(final CustomMesh mesh, final String name, final int tp) { final Content c = new Content(name, tp); final ContentInstant content = c.getInstant(tp); content.color = mesh.getColor(); content.transparency = mesh.getTransparency(); content.shaded = mesh.isShaded(); content .showCoordinateSystem(UniverseSettings.showLocalCoordinateSystemsByDefault); content.display(new CustomMeshNode(mesh)); return c; }
final ContentInstant contentThisFrame = new ContentInstant( "Spots_frame_" + frame ); contentThisFrame.display( blobGroup );
final ContentInstant ci = new ContentInstant( "t0" ); ci.display( sg ); final TreeMap< Integer, ContentInstant > instants = new TreeMap< >(); instants.put( 0, ci );