/** * A static helper method to check if a type is one of the elements in an * array. * * @param type * A pixels type enumeration. * @param strings * The strings for which you want to check against. * @return True on successful match and false on failure to match. */ public static boolean in(PixelsType type, String[] strings) { String typeAsString = type.getValue(); for (int i = 0; i < strings.length; i++) { if (typeAsString.equals(strings[i])) { return true; } } return false; }
public ome.model.enums.PixelsType newInstance() { return new ome.model.enums.PixelsType(); }
@Override public Object retrieve(String field) { if (field == null) { return null; } else if (field.equals(ID)) { return getId(); } else if (field.equals(VALUE)) { return getValue(); } else if (field.equals(BITSIZE)) { return getBitSize(); } else if (field.equals(DETAILS)) { return getDetails(); } else { if (_dynamicFields != null) { return _dynamicFields.get(field); } return null; } }
@Override public void putAt(String field, Object value) { if (field == null) { return; } else if (field.equals(ID)) { setId((Long) value); } else if (field.equals(VALUE)) { setValue((java.lang.String)value); } else if (field.equals(BITSIZE)) { setBitSize((java.lang.Integer)value); } else if (field.equals(DETAILS)) { setDetails((ome.model.internal.Details)value); } else { if (_dynamicFields == null) { _dynamicFields = new java.util.HashMap<String, Object>(); } _dynamicFields.put(field,value); } }
double[] minmax = new double[] {0, 1}; if (type == null) return minmax; String typeAsString = type.getValue(); int bfPixelsType = FormatTools.pixelTypeFromString(typeAsString); significantBits = type.getBitSize(); significantBits = Math.min(significantBits, type.getBitSize()); if (FormatTools.isSigned(bfPixelsType)) { minmax[0] = -Math.pow(2, significantBits - 1);
/** * Retrieves the quantum strategy for each active channels * * @return the active channel color data. */ private List<QuantumStrategy> getStrategies() { ChannelBinding[] channelBindings = renderer.getChannelBindings(); QuantumManager qManager = renderer.getQuantumManager(); List<QuantumStrategy> strats = new ArrayList<QuantumStrategy>(); for (int w = 0; w < channelBindings.length; w++) { if (channelBindings[w].getActive()) { strats.add(qManager.getStrategyFor(w)); } } Map<byte[], Integer> overlays = renderer.getOverlays(); if (overlays != null) { QuantumDef def = new QuantumDef(); // Just to fulfill interface Pixels pixels = new Pixels(); PixelsType bitType = new PixelsType(); bitType.setValue(PixelsType.VALUE_BIT); bitType.setBitSize(1); pixels.setPixelsType(bitType); for (int i = 0; i < overlays.size(); i++) { strats.add(new BinaryMaskQuantizer(def, pixels)); } } return strats; }
public PixelsType (String value) { this(null, true); setValue(value); }
/** * Use the {@link ome.model.internal.Details#copy(ome.model.internal.Details)} * or {@link ome.model.internal.Details#shallowCopy(ome.model.internal.Details)} * methods to set the {@link Details} instance instead. */ protected void setDetails(ome.model.internal.Details details) { if (! _loaded ) errorIfUnloaded(); this.details = (Details) details; }
public void setValue(java.lang.String value) { if (! _loaded ) errorIfUnloaded(); this.value = (java.lang.String) value; } protected java.lang.Integer bitSize = null;
/** * Creates a new strategy. * * @param qd Quantum definition object, contained mapping data. * @param pixels The pixels */ public BinaryMaskQuantizer(QuantumDef qd, Pixels pixels) { super(qd, pixels); PixelsType type = pixels.getPixelsType(); if (!PixelsType.VALUE_BIT.equals(type.getValue())) { throw new IllegalArgumentException( "The type " + type.getValue() + " != 'bit'."); } }
public ome.model.enums.PixelsType proxy() { return new ome.model.enums.PixelsType(this.id, false); }
public void setBitSize(java.lang.Integer bitSize) { if (! _loaded ) errorIfUnloaded(); this.bitSize = (java.lang.Integer) bitSize; } protected ome.model.internal.Details details = new Details();
/** * Returns the pixels type as a int. * * @param type The type. * @return See above. */ private static int getPixelType(PixelsType type) { if (type == null) return -1; return FormatTools.pixelTypeFromString(type.getValue()); }
/** * Simple field ome.model.enums.PixelsType.value (java.lang.String) */ // No @Type annotation @org.hibernate.search.annotations.Fields({ @org.hibernate.search.annotations.Field(index = org.hibernate.search.annotations.Index.TOKENIZED), @org.hibernate.search.annotations.Field(index = org.hibernate.search.annotations.Index.TOKENIZED, name="combined_fields") }) @javax.persistence.Column(columnDefinition="", nullable=false, unique=true, name="value", updatable=true) public java.lang.String getValue() { if (! _loaded ) errorIfUnloaded(); return this.value; }
public PixelData getPlane(Integer z, Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException { ByteBuffer buf = ByteBuffer.wrap(planes[z][c][t]); return new PixelData(pixels.getPixelsType().getValue(), buf); }
/** * Simple field ome.model.enums.PixelsType.bitSize (java.lang.Integer) */ // No @Type annotation @org.hibernate.search.annotations.Fields({ @org.hibernate.search.annotations.Field(index = org.hibernate.search.annotations.Index.UN_TOKENIZED), @org.hibernate.search.annotations.Field(index = org.hibernate.search.annotations.Index.UN_TOKENIZED, name="combined_fields") }) @javax.persistence.Column(columnDefinition="", nullable=true, unique=false, name="bitSize", updatable=true) public java.lang.Integer getBitSize() { if (! _loaded ) errorIfUnloaded(); return this.bitSize; }
/** * Implemented as specified by {@link PixelBuffer} I/F. * @see PixelBuffer#getByteWidth() */ public int getByteWidth() { return PixelData.getBitDepth(pixels.getPixelsType().getValue()) / 8; }
@Override public ome.model.internal.Details getDetails() { if (! _loaded ) errorIfUnloaded(); return this.details;