private Color getChannelColor(int colorCode) { switch (colorCode) { case 0: // red return new Color(255, 0, 0, 255); case 1: // green return new Color(0, 255, 0, 255); case 2: // blue return new Color(0, 0, 255, 255); case 3: // cyan return new Color(0, 255, 255, 255); case 4: // magenta return new Color(255, 0, 255, 255); case 5: // yellow return new Color(255, 255, 0, 255); } return new Color(255, 255, 255, 255); }
private Color getChannelColor(int colorCode) { switch (colorCode) { case 0: // red return new Color(255, 0, 0, 255); case 1: // green return new Color(0, 255, 0, 255); case 2: // blue return new Color(0, 0, 255, 255); case 3: // cyan return new Color(0, 255, 255, 255); case 4: // magenta return new Color(255, 0, 255, 255); case 5: // yellow return new Color(255, 255, 0, 255); } return new Color(255, 255, 255, 255); }
/** * Returns an <code>Color</code> object holding the value of * the specified string. * @param s The string to be parsed. * @return See above. */ public static Color valueOf(String s) { return new Color(Integer.valueOf(s)); }
/** * Returns an <code>Color</code> object holding the value of * the specified string. * @param s The string to be parsed. * @return See above. */ public static Color valueOf(String s) { return new Color(Integer.valueOf(s)); }
/** * Converts the Java Color into an OME-XML Color. * * @param color The color to convert * @return See above */ private static ome.xml.model.primitives.Color toOMExmlColor(Color color) { return new ome.xml.model.primitives.Color(color.getRed(), color.getGreen(), color.getBlue(),color.getAlpha()); }
/** * Converts the Java Color into an OME-XML Color. * * @param color The color to convert * @return See above */ private static ome.xml.model.primitives.Color toOMExmlColor(Color color) { return new ome.xml.model.primitives.Color(color.getRed(), color.getGreen(), color.getBlue(),color.getAlpha()); }
private static Color hex2Rgb(String colorStr) { int red = Integer.parseInt(colorStr.substring(1, 3), 16); int green = Integer.parseInt(colorStr.substring(3, 5), 16); int blue = Integer.parseInt(colorStr.substring(5, 7), 16); return new Color(red, green, blue, 0xff); }
private static Color hex2Rgb(String colorStr) { int red = Integer.parseInt(colorStr.substring(1, 3), 16); int green = Integer.parseInt(colorStr.substring(3, 5), 16); int blue = Integer.parseInt(colorStr.substring(5, 7), 16); return new Color(red, green, blue, 0xff); }
private <X extends Shape> Color getShapeFillColor(int ROIIndex, int shapeIndex, Class<X> expectedSubclass) { final X shape = getShape(ROIIndex, shapeIndex, expectedSubclass); if (shape == null) { return null; } final Integer color = fromRType(shape.getFillColor()); if (color == null) { return null; } return new Color(color); }
private <X extends Shape> Color getShapeStrokeColor(int ROIIndex, int shapeIndex, Class<X> expectedSubclass) { final X shape = getShape(ROIIndex, shapeIndex, expectedSubclass); if (shape == null) { return null; } final Integer color = fromRType(shape.getStrokeColor()); if (color == null) { return null; } return new Color(color); }
final int b = Integer.parseInt( getChildText( colorElement, "B" ) ); final int a = Integer.parseInt( getChildText( colorElement, "A" ) ); final Color channelColor = new Color( r, g, b, a ); ci.color = channelColor;
final int b = Integer.parseInt( getChildText( colorElement, "B" ) ); final int a = Integer.parseInt( getChildText( colorElement, "A" ) ); final Color channelColor = new Color( r, g, b, a ); ci.color = channelColor;
@Override public Color getChannelColor(int imageIndex, int channelIndex) { Channel o = getChannel(imageIndex, channelIndex); if (o == null) { return null; } try { return new Color( fromRType(o.getRed()), fromRType(o.getGreen()), fromRType(o.getBlue()), fromRType(o.getAlpha())); } catch (NullPointerException e) { return null; } }
store.setLineStrokeColor(new ome.xml.model.primitives.Color(shape1.getStrokeColor().getValue()), roiNum, shapeNum); store.setLineFillColor(new ome.xml.model.primitives.Color(shape1.getFillColor().getValue()), roiNum, shapeNum);
/** * Creates a channel. * * @param index The index in the file. * @return See above. */ public Channel createChannel(int index) { Channel channel = new Channel(); channel.setID("Channel:"+index); channel.setAcquisitionMode(AcquisitionMode.FLUORESCENCELIFETIME); int argb = DEFAULT_COLOR.getRGB(); int rgba = (argb << 8) | (argb >>> (32-8)); channel.setColor(new ome.xml.model.primitives.Color(rgba)); channel.setName("Name"); channel.setIlluminationType(IlluminationType.OBLIQUE); channel.setPinholeSize(new Length(0.5, UNITS.MICROMETER)); channel.setContrastMethod(ContrastMethod.BRIGHTFIELD); PositiveFloat emWave = new PositiveFloat(300.3); channel.setEmissionWavelength(new Length(emWave.getValue(), UNITS.NANOMETER)); PositiveFloat exWave = new PositiveFloat(400.3); channel.setExcitationWavelength(new Length(exWave.getValue(), UNITS.NANOMETER)); channel.setFluor("Fluor"); channel.setNDFilter(1.0); channel.setPockelCellSetting(0); return channel; }
/** Converts omero.model.Shape (omero.model.PointI in this case) to ome.xml.model.* and updates the MetadataStore */ private static void storeOmeroPoint(omero.model.Shape shape, MetadataStore store, int roiNum, int shapeNum) { PointI shape1 = (PointI) shape; double ox1 = shape1.getX().getValue(); double oy1 = shape1.getY().getValue(); String polylineID = MetadataTools.createLSID("Shape", roiNum, shapeNum); store.setPointID(polylineID, roiNum, shapeNum); store.setPointX(ox1, roiNum, shapeNum); store.setPointY(oy1, roiNum, shapeNum); store.setPointTheC(unwrap(shape1.getTheC()), roiNum, shapeNum); store.setPointTheZ(unwrap(shape1.getTheZ()), roiNum, shapeNum); store.setPointTheT(unwrap(shape1.getTheT()), roiNum, shapeNum); if (shape1.getTextValue() != null){ store.setPointText(shape1.getTextValue().getValue(), roiNum, shapeNum); } if (shape1.getStrokeWidth() != null) { store.setPointStrokeWidth(new ome.units.quantity.Length(shape1.getStrokeWidth().getValue(), UNITS.PIXEL), roiNum, shapeNum); } if (shape1.getStrokeColor() != null){ store.setPointStrokeColor(new ome.xml.model.primitives.Color(shape1.getStrokeColor().getValue()), roiNum, shapeNum); } if (shape1.getFillColor() != null){ store.setPointFillColor(new ome.xml.model.primitives.Color(shape1.getFillColor().getValue()), roiNum, shapeNum); } } /** Converts omero.model.Shape (omero.model.LineI in this case) to ome.xml.model.* and updates the MetadataStore */
/** Converts omero.model.Shape (omero.model.Label in this case) to ome.xml.model.* and updates the MetadataStore */ private static void storeOmeroLabel(Shape shape, MetadataStore store, int roiNum, int shapeNum) { Label shape1 = (Label) shape; String polylineID = MetadataTools.createLSID("Shape", roiNum, shapeNum); store.setLabelID(polylineID, roiNum, shapeNum); if (shape1.getTextValue() != null){ store.setLabelText(shape1.getTextValue().getValue(), roiNum, shapeNum); } store.setLabelX(shape1.getX().getValue(), roiNum, shapeNum); store.setLabelY(shape1.getY().getValue(), roiNum, shapeNum); store.setLabelTheC(unwrap(shape1.getTheC()), roiNum, shapeNum); store.setLabelTheZ(unwrap(shape1.getTheZ()), roiNum, shapeNum); store.setLabelTheT(unwrap(shape1.getTheT()), roiNum, shapeNum); if (shape1.getStrokeWidth() != null) { store.setLabelStrokeWidth(new ome.units.quantity.Length(shape1.getStrokeWidth().getValue(), UNITS.PIXEL), roiNum, shapeNum); } if (shape1.getStrokeColor() != null){ store.setLabelStrokeColor(new ome.xml.model.primitives.Color(shape1.getStrokeColor().getValue()), roiNum, shapeNum); } if (shape1.getFillColor() != null){ store.setLabelFillColor(new ome.xml.model.primitives.Color(shape1.getFillColor().getValue()), roiNum, shapeNum); } if (shape1.getFontSize() != null){ ome.units.quantity.Length labelSize = new ome.units.quantity.Length(shape1.getFontSize().getValue(), UNITS.PIXEL); store.setLabelFontSize(labelSize , roiNum, shapeNum); } }
store.setRectangleStrokeColor(new ome.xml.model.primitives.Color(shape1.getStrokeColor().getValue()), roiNum, shapeNum); store.setRectangleFillColor(new ome.xml.model.primitives.Color(shape1.getFillColor().getValue()), roiNum, shapeNum);
store.setEllipseStrokeColor(new ome.xml.model.primitives.Color(shape1.getStrokeColor().getValue()), roiNum, shapeNum); store.setEllipseFillColor(new ome.xml.model.primitives.Color(shape1.getFillColor().getValue()), roiNum, shapeNum);
store.setMaskStrokeColor(new ome.xml.model.primitives.Color(shape1.getStrokeColor().getValue()), roiNum, shapeNum); store.setMaskFillColor(new ome.xml.model.primitives.Color(shape1.getFillColor().getValue()), roiNum, shapeNum);