@Override public void clear() { universe.removeContent( SPOT_CONTENT_NAME ); universe.removeContent( TRACK_CONTENT_NAME ); }
synchronized public void removeFrom3DViewer(final Image3DUniverse univ) { if (content3D != null) { univ.removeContent(nameWhenAddedToViewer); content3D = null; } if (content3DExtra != null) { univ.removeContent(nameWhenAddedToViewerExtra); content3DExtra = null; } }
@Override public void clear() { universe.removeContent( SPOT_CONTENT_NAME ); universe.removeContent( TRACK_CONTENT_NAME ); }
protected void removeSphere(final String name) { if (use3DViewer) univ.removeContent(name); }
/** * Remove all the contents of this universe. */ public void removeAllContents() { final String[] names = new String[contents.size()]; contents.keySet().toArray(names); for (int i = 0; i < names.length; i++) removeContent(names[i]); }
@Override public void actionPerformed(final ActionEvent e) { String s = regex.getText(); if (0 == s.length()) return; if (!s.startsWith("^")) s = "^.*" + s; if (!s.endsWith("$")) s = s + ".*$"; Pattern pattern = null; try { pattern = Pattern.compile(s); } catch (final PatternSyntaxException pse) { JOptionPane.showMessageDialog(univ.getWindow(), "Error parsing the regular expression:\n" + pse.getMessage()); return; } for (final Content c : new ArrayList<Content>(getOrderedContents(univ))) { if (pattern.matcher(c.getName()).matches()) { univ.removeContent(c.getName()); Utils.log("Removed " + c.getName()); } } } };
public void delete(final Content c) { if (!checkSel(c)) return; univ.removeContent(c.getName()); record(DELETE); }
/** Considers there is only one Display3D for each LayerSet. */ static public void remove(final ProjectThing pt) { if (null == pt) return; if (null == pt.getObject()) return; final Object ob = pt.getObject(); if (!(ob instanceof Displayable)) return; final Displayable displ = (Displayable)ob; final Display3D d3d = ht_layer_sets.get(displ.getLayerSet()); // TODO profile_list is going to fail here if (null == d3d) { // there is no Display3D showing the pt to remove //Utils.log2("No Display3D contains ProjectThing: " + pt); return; } String name; synchronized (d3d.ht_pt_meshes) { name = d3d.ht_pt_meshes.remove(pt); } if (null == name) { Utils.log2("No mesh contained within " + d3d + " for ProjectThing " + pt); return; } d3d.universe.removeContent(name); }
public static void delete() { final Image3DUniverse univ = getUniv(); if (univ != null && univ.getSelected() != null) { univ.removeContent(univ.getSelected().getName()); } }
public void updatePreview() { final String name = getNameForContent(); if (content != null) univ.removeContent(content.getName()); final Primitive prim = getPrimitive(); if (prim != null) content = univ.addCustomMesh(prim, name); } }
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 ); }
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 ); }
@Override public Content call() { try { // 1 - Create content final Callable<Content> c = createMesh(pt, displ, resample); if (null == c) return null; final Content content = c.call(); if (null == content) return null; final String title = content.getName(); // 2 - Remove from universe any content of the same title if (universe.contains(title)) { universe.removeContent(title); } // 3 - Add to universe, and wait universe.addContentLater(content).get(); return content; } catch (final Exception e) { IJError.print(e); return null; } } });
private void setModel( final Model model ) { if ( model.getSpots() != null ) { makeSpotContent(); } if ( model.getTrackModel().nTracks( true ) > 0 ) { trackContent = makeTrackContent(); universe.removeContent( TRACK_CONTENT_NAME ); universe.addContentLater( trackContent ); } }
private void setModel( final Model model ) { if ( model.getSpots() != null ) { makeSpotContent(); } if ( model.getTrackModel().nTracks( true ) > 0 ) { trackContent = makeTrackContent(); universe.removeContent( TRACK_CONTENT_NAME ); universe.addContentLater( trackContent ); } }
public BoxDialog(final Image3DUniverse univ) { super("Box", univ); addStringField("Name", ""); addStringField("Lower corner", ""); addStringField("Upper corner", ""); @SuppressWarnings("rawtypes") final Vector v = getStringFields(); tf0 = (TextField) v.get(0); tf1 = (TextField) v.get(1); tf2 = (TextField) v.get(2); tf0.addFocusListener(this); tf1.addFocusListener(this); tf2.addFocusListener(this); showDialog(); if (wasCanceled()) univ.removeContent(tf0.getText()); else{ updatePreview(); Executer.record( Executer.ADD_BOX, tf0.getText(), tf1.getText(), tf2.getText()); } }
/** Expects uncalibrated wx,wy,wz, (i.e. pixel values), to be calibrated by @param ls calibration. */ static public final Future<Content> addFatPoint(final String title, final LayerSet ls, final double wx, final double wy, final double wz, final double wr, final Color color) { final Display3D d3d = Display3D.get(ls); d3d.universe.removeContent(title); final Content ct = d3d.universe.createContent(new CustomTriangleMesh(d3d.createFatPoint(wx, wy, wz, wr, ls.getCalibrationCopy()), new Color3f(color), 0), title); ct.setLocked(true); return d3d.addContent(ct); }
static public void showOrthoslices(final ImagePlus imp, final String title, final int wx, final int wy, final float scale2D, final Layer first) { final Display3D d3d = get(first.getParent()); d3d.universe.removeContent(title); final Content ct = d3d.universe.addOrthoslice(imp, null, title, 0, new boolean[]{true, true, true}, 1); final Calibration cal = imp.getCalibration(); final Transform3D t = new Transform3D(new double[]{1, 0, 0, wx * cal.pixelWidth * scale2D, 0, 1, 0, wy * cal.pixelHeight * scale2D, 0, 0, scale2D, first.getZ() * cal.pixelWidth * scale2D, // not pixelDepth! 0, 0, 0, 1}); // why scale2D has to be there at all reflects a horrible underlying setting of the calibration, plus of the scaling in the Display3D. Utils.log(t); ct.applyTransform(t); ct.setLocked(true); }
static public void showOrthoslices(final Patch p) { final Display3D d3d = get(p.getLayerSet()); d3d.adjustResampling(); //d3d.universe.resetView(); final String title = makeTitle(p) + " orthoslices"; // remove if present d3d.universe.removeContent(title); final PatchStack ps = p.makePatchStack(); final ImagePlus imp = get8BitStack(ps); final Content ct = d3d.universe.addOrthoslice(imp, null, title, 0, new boolean[]{true, true, true}, d3d.resample); setTransform(ct, ps.getPatch(0)); ct.setLocked(true); // locks the added content }
static public void showVolume(final Patch p) { final Display3D d3d = get(p.getLayerSet()); d3d.adjustResampling(); //d3d.universe.resetView(); final String title = makeTitle(p) + " volume"; // remove if present d3d.universe.removeContent(title); final PatchStack ps = p.makePatchStack(); final ImagePlus imp = get8BitStack(ps); final Content ct = d3d.universe.addVoltex(imp, null, title, 0, new boolean[]{true, true, true}, d3d.resample); setTransform(ct, ps.getPatch(0)); ct.setLocked(true); // locks the added content }