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; }
@Override public Object getValueAt(final int rowIndex, final int columnIndex) { switch (columnIndex) { case 0: return rowIndex + 1; case 1: return contents.get(rowIndex).getName(); } return null; }
static public final void randomizeColors(final Image3DUniverse univ) { final ArrayList<Content> cs = new ArrayList<Content>(getOrderedContents(univ)); for (int i=0; i<cs.size(); ++i) { if (i < colors.length) { cs.get(i).setColor(new Color3f(colors[i])); } else { cs.get(i).setColor(new Color3f((float)Math.random(), (float)Math.random(), (float)Math.random())); } } // Update the color bars if something is selected: final Content content = univ.getSelected(); if (null != content) univ.fireContentChanged(content); }
@Test @InSequence(1) public void shouldLoadContentAndRevision() throws Exception { Content content = entityManager.find(Content.class, Long.valueOf(1)); assertNotNull("should have found content #1", content); // same checks as before: assertNotNull("content should have current revision", content.getCurrent()); assertSame("content should be same as revision's parent", content, content.getCurrent().getContent()); assertEquals("content should have 1 revision", 1, content.getRevisionList().size()); assertSame("the list should contain same reference", content.getCurrent(), content.getRevisionList().get(0)); }
void saveContent(final PrintWriter out, final Content c) { out.println("BeginContent"); out.println("name = " + c.getName()); for (final ContentInstant ci : c.getInstants().values()) saveContentInstant(out, ci); out.println("EndContent"); }
public void updateVolume(final Content c) { if (!checkSel(c)) return; if (c.getType() != ContentConstants.VOLUME && c.getType() != ContentConstants.ORTHO) return; if (c.getResamplingFactor() != 1) { IJ.error("Object must be loaded " + "with resamplingfactor 1"); return; } ((VoltexGroup) c.getContent()).update(); }
@SuppressWarnings("serial") public void setTransform(final Content c) { if (!checkSel(c)) return; if (c.isLocked()) { IJ.error(c.getName() + " is locked"); return; c.getLocalTranslate().getTransform(org); final Transform3D t2 = new Transform3D(); c.getLocalRotate().getTransform(t2); org.mul(t2); final Matrix4f m = new Matrix4f(); c.getContent().getCenter(contentCenter); final Point3f center = new Point3f(contentCenter);
final ContentNode cn = ((Content) content).getContent(); CustomTriangleMesh ctm = null; if (cn instanceof CustomMeshNode) { final Content c = (Content) content; final Mesh m = new Mesh(ctm, c.getName(), c.getColor(), c.getTransparency()); m.getMinMax(min, max); meshes.add(m);
ct.setTransparency(1f - alpha); ct.setLocked(true); ht_pt_meshes.put(pt, ct.getName());
/** * Constructs a surface plot for the given ContentInstant. * * @param c */ public SurfacePlotGroup(final Content c) { this(c.getCurrent()); }
/** Returns true on success. */ private boolean addContentToScene(final Content c) { synchronized (lock) { final String name = c.getName(); if (contents.containsKey(name)) { IJ.log("Mesh named '" + name + "' exists already"); return false; } // update start and end time int st = startTime; int e = endTime; if (c.getStartTime() < startTime) st = c.getStartTime(); if (c.getEndTime() > endTime) e = c.getEndTime(); updateStartAndEndTime(st, e); this.scene.addChild(c); this.contents.put(name, c); this.recalculateGlobalMinMax(c); c.setPointListDialog(plDialog); c.showTimepoint(currentTimepoint, true); } return true; }
public Content asContent(final Display3D d3d) { double[] wi = widths; if (null == widths) { wi = new double[vs.getPoints(0).length]; Arrays.fill(wi, 2.0); } else if (widths.length != vs.length()) { Utils.log("ERROR: widths.length != VectorString3D.length()"); return null; } float transp = 1 - alpha; if (transp < 0) transp = 0; if (transp > 1) transp = 1; if (1 == transp) { Utils.log("WARNING: adding a 3D object fully transparent."); } final List<Point3f> triangles = Pipe.generateTriangles(Pipe.makeTube(vs.getPoints(0), vs.getPoints(1), vs.getPoints(2), wi, 1, 12, null), d3d.scale); final Content ct = d3d.universe.createContent(new CustomTriangleMesh(triangles, new Color3f(color), 0), title); ct.setTransparency(transp); ct.setLocked(true); return ct; } }
private void makeSpotContent() { blobs = new TreeMap<>(); contentAllFrames = new TreeMap< >(); final double radiusRatio = ( Double ) displaySettings.get( KEY_SPOT_RADIUS_RATIO ); final SpotCollection spots = model.getSpots(); @SuppressWarnings( "unchecked" ) final FeatureColorGenerator< Spot > spotColorGenerator = ( FeatureColorGenerator< Spot > ) displaySettings.get( KEY_SPOT_COLORING ); for ( final int frame : spots.keySet() ) { if ( spots.getNSpots( frame, false ) == 0 ) { continue; // Do not create content for empty frames } buildFrameContent( spots, frame, radiusRatio, spotColorGenerator ); } spotContent = new Content( SPOT_CONTENT_NAME, contentAllFrames ); spotContent.showCoordinateSystem( false ); universe.removeContent( SPOT_CONTENT_NAME ); universe.addContentLater( spotContent ); }
static public void writeDXF(final Collection contents, final Writer w) throws IOException { w.write("0\nSECTION\n2\nENTITIES\n"); // header of file for (final Iterator it = contents.iterator(); it.hasNext();) { final Content ob = (Content) it.next(); CustomMesh cmesh = null; if (ob.getContent() instanceof CustomMeshNode) { final CustomMeshNode cmeshnode = (CustomMeshNode) ob.getContent(); cmesh = cmeshnode.getMesh(); } else if (ob.getContent() instanceof MeshGroup) { final MeshGroup mg = (MeshGroup) ob.getContent(); cmesh = mg.getMesh(); } else continue; final List triangles = cmesh.getMesh(); final String title = ob.getName().replaceAll(" ", "_").replaceAll("#", "--"); final Mtl mat = new Mtl(1 - ob.getTransparency(), cmesh.getColor()); writeTrianglesDXF(w, triangles, title, "" + mat.getAsSingle()); } w.append("0\nENDSEC\n0\nEOF\n"); // TRAILER of the file }
public void setLocked(final Content c, final boolean b) { if (!checkSel(c)) return; c.setLocked(b); if (b) record(LOCK); else record(UNLOCK); }
final PointList tpoints = templ.getPointList(); final PointList mpoints = model.getPointList(); if (tpoints.size() < 2 || mpoints.size() < 2) { IJ.error("At least two points are required in each " templ.setTransform(new Transform3D()); model.setTransform(t3d); templ.setVisible(true); templ.setLocked(true); model.setVisible(true); model.setLocked(true);
private void selectLandmarkSet(final Content content, final String actionCommand) { hideAll(); content.setVisible(true); content.displayAs(ContentConstants.ORTHO); content.showPointList(true); univ.ui.setPointTool(); univ.select(content); univ .setStatus("Select landmarks in " + content.getName() + " and click OK"); final Panel p = new Panel(new FlowLayout()); Button b = new Button("OK"); b.setActionCommand(actionCommand); b.addActionListener(this); p.add(b); if (actionCommand.equals("REGISTER")) { b = new Button("Back to template"); b.setActionCommand("LS_TEMPLATE"); b.addActionListener(this); p.add(b); } univ.getPointListDialog().addPanel(p); }
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; }
final Content mob = (Content) it.next(); final ContentNode node = mob.getContent(); final CustomMultiMesh multi = (CustomMultiMesh) node; for (int i = 0; i < multi.size(); i++) { meshes.put(mob.getName() + " [" + (i + 1) + "]", multi.getMesh(i)); meshes.put(mob.getName(), ((CustomMeshNode) node).getMesh()); meshes.put(mob.getName(), ((MeshGroup) node).getMesh()); IJ.log("Ignoring " + mob.getName() + " with node of class " + node.getClass()); continue;
public Content readContent(final BufferedReader in) throws IOException { String name = null; String line; boolean foundNext = false; while ((line = in.readLine()) != null) { if (line.startsWith("BeginContent")) { foundNext = true; break; } } if (!foundNext) return null; while ((line = in.readLine()) != null) { if (line.startsWith("name")) { name = line.split("=")[1].trim(); break; } } final TreeMap<Integer, ContentInstant> cis = new TreeMap<Integer, ContentInstant>(); ContentInstant ci = null; while ((ci = readContentInstant(in)) != null) cis.put(ci.timepoint, ci); if (name == null) throw new RuntimeException("no name for content"); return new Content(name, cis); }