本文整理汇总了Java中ome.units.quantity.Length类的典型用法代码示例。如果您正苦于以下问题:Java Length类的具体用法?Java Length怎么用?Java Length使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Length类属于ome.units.quantity包,在下文中一共展示了Length类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getPosition
import ome.units.quantity.Length; //导入依赖的package包/类
private static double getPosition( final Length planePos, final Length stageLabel, final boolean invert )
{
// check plane position
if ( planePos != null )
return invert ? -planePos.value().doubleValue() : planePos.value().doubleValue();
// check global stage label
if ( stageLabel != null )
return invert ? -stageLabel.value().doubleValue() : stageLabel.value().doubleValue();
return 0;
}
开发者ID:fiji,项目名称:Stitching,代码行数:13,代码来源:CommonFunctions.java
示例2: translateFormatMetadata
import ome.units.quantity.Length; //导入依赖的package包/类
@Override
protected void translateFormatMetadata(final OBFFormat.Metadata source,
final OMEMetadata dest)
{
for (int image = 0; image != source.getImageCount(); ++image) {
final ImageMetadata obf = source.get(image);
final String name = obf.getTable().get("Name").toString();
dest.getRoot().setImageName(name, image);
@SuppressWarnings("unchecked")
final List<Double> lengths = //
(List<Double>) obf.getTable().get("Lengths");
final double lengthX = Math.abs(lengths.get(0));
if (lengthX > 0) {
final Length physicalSizeX = //
new Length(lengthX / obf.getAxisLength(Axes.X), UNITS.MICROMETER);
dest.getRoot().setPixelsPhysicalSizeX(physicalSizeX, image);
}
final double lengthY = Math.abs(lengths.get(1));
if (lengthY > 0) {
final Length physicalSizeY = //
new Length(lengthY / obf.getAxisLength(Axes.Y), UNITS.MICROMETER);
dest.getRoot().setPixelsPhysicalSizeY(physicalSizeY, image);
}
final double lengthZ = Math.abs(lengths.get(2));
if (lengthZ > 0) {
final Length physicalSizeZ = //
new Length(lengthZ / obf.getAxisLength(Axes.Z), UNITS.MICROMETER);
dest.getRoot().setPixelsPhysicalSizeZ(physicalSizeZ, image);
}
}
}
开发者ID:scifio,项目名称:scifio-ome-xml,代码行数:35,代码来源:OBFTranslator.java
示例3: translateFormatMetadata
import ome.units.quantity.Length; //导入依赖的package包/类
@Override
protected void translateFormatMetadata(final TIFFFormat.Metadata source,
final OMEMetadata dest)
{
final OMEXMLMetadata meta = dest.getRoot();
final CalibratedAxis xAxis = source.get(0).getAxis(Axes.X);
final CalibratedAxis yAxis = source.get(0).getAxis(Axes.Y);
final CalibratedAxis zAxis = source.get(0).getAxis(Axes.Z);
final double physX = xAxis == null ? 1.0 : xAxis.averageScale(0.0, 1.0);
final double physY = yAxis == null ? 1.0 : yAxis.averageScale(0.0, 1.0);
final double physZ = zAxis == null ? 1.0 : zAxis.averageScale(0.0, 1.0);
meta.setPixelsPhysicalSizeX(//
new Length(physX > 0 ? physX : 1.0, UNITS.MICROMETER), 0);
meta.setPixelsPhysicalSizeY(//
new Length(physY > 0 ? physY : 1.0, UNITS.MICROMETER), 0);
meta.setPixelsPhysicalSizeZ(//
new Length(physZ > 0 ? physZ : 1.0, UNITS.MICROMETER), 0);
meta.setImageDescription(source.getDescription(), 0);
meta.setExperimenterFirstName(source.getExperimenterFirstName(), 0);
meta.setExperimenterLastName(source.getExperimenterLastName(), 0);
meta.setExperimenterEmail(source.getExperimenterEmail(), 0);
final String creationDate = source.getCreationDate();
if (creationDate != null) meta.setImageAcquisitionDate(new Timestamp(
creationDate), 0);
}
开发者ID:scifio,项目名称:scifio-ome-xml,代码行数:31,代码来源:TIFFTranslator.java
示例4: translateFormatMetadata
import ome.units.quantity.Length; //导入依赖的package包/类
@Override
protected void translateFormatMetadata(final NRRDFormat.Metadata source,
final OMEMetadata dest)
{
final String[] pixelSizes = source.getPixelSizes();
if (pixelSizes != null) {
for (int i = 0; i < pixelSizes.length; i++) {
if (pixelSizes[i] == null) continue;
try {
final Double d = new Double(pixelSizes[i].trim());
if (d > 0) {
if (i == 0) {
dest.getRoot().setPixelsPhysicalSizeX(//
new Length(d, UNITS.MICROMETER), 0);
}
else if (i == 1) {
dest.getRoot().setPixelsPhysicalSizeY(//
new Length(d, UNITS.MICROMETER), 0);
}
else if (i == 2) {
dest.getRoot().setPixelsPhysicalSizeZ(//
new Length(d, UNITS.MICROMETER), 0);
}
}
else {
log().warn("Expected positive value for PhysicalSize; got " + d);
}
}
catch (final NumberFormatException e) {}
}
}
}
开发者ID:scifio,项目名称:scifio-ome-xml,代码行数:35,代码来源:NRRDTranslator.java
示例5: translateFormatMetadata
import ome.units.quantity.Length; //导入依赖的package包/类
@Override
protected void translateFormatMetadata(final BMPFormat.Metadata source,
final OMEMetadata dest)
{
// resolution is stored as pixels per meter;
// we want to convert to microns per pixel
final Integer pixelSizeX = //
(Integer) source.getTable().get("X resolution");
final Integer pixelSizeY = //
(Integer) source.getTable().get("Y resolution");
final double correctedX = pixelSizeX == null || pixelSizeX == 0 ? //
0.0 : 1000000.0 / pixelSizeX;
final double correctedY = pixelSizeY == null || pixelSizeY == 0 ? //
0.0 : 1000000.0 / pixelSizeY;
if (correctedX > 0) {
dest.getRoot().setPixelsPhysicalSizeX(//
new Length(correctedX, UNITS.MICROMETER), 0);
}
else {
log().warn("Expected positive value for PhysicalSizeX; got " +
correctedX);
}
if (correctedY > 0) {
dest.getRoot().setPixelsPhysicalSizeY(//
new Length(correctedY, UNITS.MICROMETER), 0);
}
else {
log().warn("Expected positive value for PhysicalSizeY; got " +
correctedY);
}
}
开发者ID:scifio,项目名称:scifio-ome-xml,代码行数:36,代码来源:BMPTranslator.java
示例6: populateCalibrations
import ome.units.quantity.Length; //导入依赖的package包/类
private void populateCalibrations(final MetadataStore store,
final int imageIndex, final double calX, final double calY,
final double calZ, final double calC, final double calT)
{
store.setPixelsPhysicalSizeX(//
new Length(calX, UNITS.MICROMETER), imageIndex);
store.setPixelsPhysicalSizeY(//
new Length(calY, UNITS.MICROMETER), imageIndex);
store.setPixelsPhysicalSizeZ(//
new Length(calZ, UNITS.MICROMETER), imageIndex);
store.setPixelsTimeIncrement(new Time(calT, UNITS.SECOND), imageIndex);
}
开发者ID:scifio,项目名称:scifio-ome-xml,代码行数:13,代码来源:DefaultOMEMetadataService.java
示例7: calibrate
import ome.units.quantity.Length; //导入依赖的package包/类
/**
* Calibrates the given axis if the physical pixel size is non-null
* @param stageLabel
*/
private static void calibrate(Length pixelsPhysicalSize,
CalibratedAxis axis, Length stageLabel)
{
if (pixelsPhysicalSize != null) {
FormatTools.calibrate(axis, pixelsPhysicalSize.value().doubleValue(),
stageLabel == null ? 0.0 : stageLabel.value().doubleValue());
}
}
开发者ID:scifio,项目名称:scifio-bf-compat,代码行数:13,代码来源:BioFormatsFormat.java
示例8: getPixelsPhysicalSizeX
import ome.units.quantity.Length; //导入依赖的package包/类
public Length getPixelsPhysicalSizeX() {
return pixelsPhysicalSizeX;
}
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:4,代码来源:OrbitImageBioformats.java
示例9: initFile
import ome.units.quantity.Length; //导入依赖的package包/类
@Override
protected void initFile(String id) throws FormatException, IOException {
super.initFile(id);
Location parent = new Location(id).getAbsoluteFile().getParentFile();
String[] lines = DataTools.readFile(currentId).split("\r\n");
for (String line : lines) {
int eq = line.indexOf('=');
if (eq < 0) {
continue;
}
String key = line.substring(0, eq).trim();
String value = line.substring(eq + 1).trim();
if (key.equals("NoImages")) {
ndpiFiles = new String[Integer.parseInt(value)];
readers = new NDPIReader[ndpiFiles.length];
}
else if (key.startsWith("Image")) {
int index = Integer.parseInt(key.replaceAll("Image", ""));
ndpiFiles[index] = new Location(parent, value).getAbsolutePath();
readers[index] = new NDPIReader();
readers[index].setFlattenedResolutions(hasFlattenedResolutions());
}
}
readers[0].setMetadataStore(getMetadataStore());
readers[0].setId(ndpiFiles[0]);
core = new ArrayList<CoreMetadata>(readers[0].getCoreMetadataList());
for (int i=0; i<core.size(); i++) {
CoreMetadata ms = core.get(i);
ms.sizeC = readers.length;
ms.rgb = false;
ms.imageCount = ms.sizeC * ms.sizeZ * ms.sizeT;
}
samplesPerPixel = new int[ndpiFiles.length];
bandUsed = new int[ndpiFiles.length];
MetadataStore store = makeFilterMetadata();
IFD ifd;
for (int c=0; c<readers.length; c++) { // populate channel names based on IFD entry
if (c>0) // 0 is already open
readers[c].setId(ndpiFiles[c]);
try (RandomAccessInputStream in = new RandomAccessInputStream(ndpiFiles[c])) {
TiffParser tp = new TiffParser(in);
ifd = tp.getIFDs().get(0);
}
samplesPerPixel[c] = ifd.getSamplesPerPixel();
String channelName = ifd.getIFDStringValue(TAG_CHANNEL);
Float wavelength = (Float) ifd.getIFDValue(TAG_EMISSION_WAVELENGTH);
store.setChannelName(channelName, getSeries(), c);
store.setChannelEmissionWavelength(new Length(wavelength, UNITS.NANOMETER),getSeries(), c);
bandUsed[c] = 0;
if (samplesPerPixel[c]>=3) {
// define band used based on emission wavelength
// wavelength = 0 Colour Image
// 380 =< wavelength <= 490 Blue
// 490 < wavelength <= 580 Green
// 580 < wavelength <= 780 Red
bandUsed[c] = 0;
if (380 < wavelength && wavelength <= 490) bandUsed[c] = 2;
else if (490 < wavelength && wavelength <= 580) bandUsed[c] = 1;
else if (580 < wavelength && wavelength <= 780) bandUsed[c] = 0;
}
}
MetadataTools.populatePixels(store, this);
}
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:73,代码来源:NDPISReaderOrbit.java
示例10: translateFormatMetadata
import ome.units.quantity.Length; //导入依赖的package包/类
@Override
protected void translateFormatMetadata(final DICOMFormat.Metadata source,
final OMEMetadata dest)
{
// The metadata store we're working with.
String stamp = null;
final OMEXMLMetadata store = dest.getRoot();
final String date = source.getDate();
final String time = source.getTime();
final String imageType = source.getImageType();
final String pixelSizeX = source.getPixelSizeX();
final String pixelSizeY = source.getPixelSizeY();
final Double pixelSizeZ = source.getPixelSizeZ();
if (date != null && time != null) {
stamp = date + " " + time;
stamp = DateTools.formatDate(stamp, "yyyy.MM.dd HH:mm:ss.SSSSSS");
}
if (stamp == null || stamp.trim().equals("")) stamp = null;
for (int i = 0; i < source.getImageCount(); i++) {
if (stamp != null) store.setImageAcquisitionDate(new Timestamp(stamp),
i);
store.setImageName("Series " + i, i);
}
for (int i = 0; i < source.getImageCount(); i++) {
store.setImageDescription(imageType, i);
if (pixelSizeX != null) {
final Double sizeX = new Double(pixelSizeX);
if (sizeX > 0) {
store.setPixelsPhysicalSizeX(//
new Length(sizeX, UNITS.MICROMETER), i);
}
else {
log().warn("Expected positive value for PhysicalSizeX; got " +
sizeX);
}
}
if (pixelSizeY != null) {
final Double sizeY = new Double(pixelSizeY);
if (sizeY > 0) {
store.setPixelsPhysicalSizeY(//
new Length(sizeY, UNITS.MICROMETER), i);
}
else {
log().warn("Expected positive value for PhysicalSizeY; got " +
sizeY);
}
}
if (pixelSizeZ != null && pixelSizeZ > 0) {
store.setPixelsPhysicalSizeZ(//
new Length(pixelSizeZ, UNITS.MICROMETER), i);
}
else {
log().warn("Expected positive value for PhysicalSizeZ; got " +
pixelSizeZ);
}
}
}
开发者ID:scifio,项目名称:scifio-ome-xml,代码行数:66,代码来源:DICOMTranslator.java
示例11: checkValue
import ome.units.quantity.Length; //导入依赖的package包/类
private double checkValue(final Length l) {
return l == null ? 1.0 : l.value().doubleValue();
}
开发者ID:scifio,项目名称:scifio-ome-xml,代码行数:4,代码来源:TIFFTranslator.java
示例12: getValue
import ome.units.quantity.Length; //导入依赖的package包/类
/**
* Helper method to extract values out of {@link PositiveFloat}s, for
* physical pixel sizes (calibration values). Returns 1.0 if given a null or
* invalid (< 0) calibration.
*/
private double getValue(final Length pixelPhysicalSize) {
if (pixelPhysicalSize == null) return 1.0;
final Double physSize = pixelPhysicalSize.value().doubleValue();
return physSize < 0 ? 1.0 : physSize;
}
开发者ID:scifio,项目名称:scifio-ome-xml,代码行数:11,代码来源:OMETIFFFormat.java
示例13: populateImageMetadata
import ome.units.quantity.Length; //导入依赖的package包/类
@Override
public void populateImageMetadata(final MetadataRetrieve retrieve,
final int imageIndex, final ImageMetadata iMeta)
{
// Get axis information from the MetadataRetrieve
final int sizeX = retrieve.getPixelsSizeX(imageIndex).getValue();
final int sizeY = retrieve.getPixelsSizeY(imageIndex).getValue();
final int sizeZ = retrieve.getPixelsSizeZ(imageIndex).getValue();
int sizeC = retrieve.getPixelsSizeC(imageIndex).getValue();
final int sizeT = retrieve.getPixelsSizeT(imageIndex).getValue();
final Length physX = retrieve.getPixelsPhysicalSizeX(imageIndex);
final Length physY = retrieve.getPixelsPhysicalSizeY(imageIndex);
final Length physZ = retrieve.getPixelsPhysicalSizeZ(imageIndex);
final Time physT = retrieve.getPixelsTimeIncrement(imageIndex);
final double calX = physX == null ? 1.0 : physX.value().doubleValue();
final double calY = physY == null ? 1.0 : physY.value().doubleValue();
final double calZ = physZ == null ? 1.0 : physZ.value().doubleValue();
final double calT = physT == null ? 1.0 : physT.value().doubleValue();
final String dimensionOrder = //
retrieve.getPixelsDimensionOrder(imageIndex).getValue();
final PositiveInteger spp = retrieve.getChannelCount(imageIndex) <= 0 ? //
null : retrieve.getChannelSamplesPerPixel(imageIndex, 0);
final boolean little = !retrieve.getPixelsBigEndian(imageIndex);
final int pType = FormatTools.pixelTypeFromString(//
retrieve.getPixelsType(imageIndex).getValue());
final int rgbCCount = spp == null ? 1 : spp.getValue();
// if we have RGB planes, there are really two "channel" axes
final int axisCount = rgbCCount == 1 ? 5 : 6;
final long[] lengths = new long[axisCount];
final CalibratedAxis[] axes = new CalibratedAxis[axisCount];
iMeta.setPlanarAxisCount(2);
// populate the axis information in dimension order
int i = 0;
for (final char d : dimensionOrder.toUpperCase().toCharArray()) {
// Check for RGB channel position
if (axisCount == 6 && i > 0 && axes[i - 1].type() == Axes.Y) {
sizeC /= rgbCCount;
lengths[i] = rgbCCount;
axes[i] = new DefaultLinearAxis(Axes.CHANNEL, "um", 1.0);
i++;
iMeta.setPlanarAxisCount(i);
}
switch (d) {
case 'X':
lengths[i] = sizeX;
axes[i] = new DefaultLinearAxis(Axes.X, "um", calX);
break;
case 'Y':
lengths[i] = sizeY;
axes[i] = new DefaultLinearAxis(Axes.Y, "um", calY);
break;
case 'Z':
lengths[i] = sizeZ;
axes[i] = new DefaultLinearAxis(Axes.Z, "um", calZ);
break;
case 'C':
lengths[i] = sizeC;
if (rgbCCount == 1) {
axes[i] = new DefaultLinearAxis(Axes.CHANNEL, "um", 1.0);
}
else {
axes[i] = new DefaultLinearAxis(Axes.get("cPlanes"), "um", 1.0);
}
break;
case 'T':
lengths[i] = sizeT;
axes[i] = new DefaultLinearAxis(Axes.TIME, "um", calT);
break;
}
i++;
}
// populate the metadata
iMeta.populate(iMeta.getName(), Arrays.asList(axes), lengths, pType,
FormatTools.getBitsPerPixel(pType), true, little, false, false, true);
}
开发者ID:scifio,项目名称:scifio-ome-xml,代码行数:81,代码来源:DefaultOMEMetadataService.java
示例14: assertQuantity
import ome.units.quantity.Length; //导入依赖的package包/类
private void assertQuantity(final double expected, final Length actual) {
assertEquals(expected, actual.value().doubleValue(), 0.0);
}
开发者ID:scifio,项目名称:scifio-ome-xml,代码行数:4,代码来源:CalibrationTest.java
示例15: mm
import ome.units.quantity.Length; //导入依赖的package包/类
private double mm(final Length l, final double defaultValue) {
return l != null && l.unit().isConvertible(UNITS.MILLIMETER) ? //
l.value(UNITS.MILLIMETER).doubleValue() : defaultValue;
}
开发者ID:scifio,项目名称:scifio-itk-bridge,代码行数:5,代码来源:SCIFIOITKBridge.java
注:本文中的ome.units.quantity.Length类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论