本文整理汇总了Java中io.scif.DefaultImageMetadata类的典型用法代码示例。如果您正苦于以下问题:Java DefaultImageMetadata类的具体用法?Java DefaultImageMetadata怎么用?Java DefaultImageMetadata使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultImageMetadata类属于io.scif包,在下文中一共展示了DefaultImageMetadata类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populateImageMetadata
import io.scif.DefaultImageMetadata; //导入依赖的package包/类
@Override
public void populateImageMetadata() {
final ImageMetadata iMeta = get(0);
iMeta.setAxisTypes(Axes.CHANNEL, Axes.X, Axes.Y);
iMeta.setIndexed(!(iMeta.getAxisLength(Axes.CHANNEL) > 1) &&
getLut() != null);
iMeta.setPlanarAxisCount(3);
// New core metadata now that we know how many sub-resolutions we
// have.
if (getResolutionLevels() != null) {
final int imageCount = resolutionLevels + 1;
// TODO set resolution count get(0).resolutionCount =
// imageCount;
for (int i = 1; i < imageCount; i++) {
final ImageMetadata ms = new DefaultImageMetadata(iMeta);
add(ms);
ms.setAxisLength(Axes.X, iMeta.getAxisLength(Axes.X) / 2);
ms.setAxisLength(Axes.Y, iMeta.getAxisLength(Axes.Y) / 2);
ms.setThumbnail(true);
}
}
}
示例2: populateImageMetadata
import io.scif.DefaultImageMetadata; //导入依赖的package包/类
@Override
public void populateImageMetadata() {
final Metadata m = unwrap();
createImageMetadata(0);
for (int i = 0; i < m.getImageCount(); i++) {
final ImageMetadata iMeta = new DefaultImageMetadata(m.get(i));
// offset to the next axis position
int offset = 0;
for (final AxisType type : splitTypes) {
// For each potentially split axis, if it's a planar axis, move
// it to a
// non-planar position
if (iMeta.getAxisIndex(type) >= 0 &&
iMeta.getAxisIndex(type) < iMeta.getPlanarAxisCount())
{
iMeta.setAxis(iMeta.getPlanarAxisCount() + offset++ - 1, iMeta
.getAxis(type));
iMeta.setPlanarAxisCount(iMeta.getPlanarAxisCount() - 1);
}
}
add(iMeta, false);
}
}
示例3: Metadata
import io.scif.DefaultImageMetadata; //导入依赖的package包/类
public Metadata() {
super();
add(new DefaultImageMetadata());
get(0).setLittleEndian(true);
}
示例4: populateMeta
import io.scif.DefaultImageMetadata; //导入依赖的package包/类
/**
* Uses the provided {@link SCIFIOImgPlus} to populate the minimum metadata
* fields necessary for writing.
*
* @param imageIndex
* @param id
*/
private void populateMeta(final Writer w, final SCIFIOImgPlus<?> img,
final SCIFIOConfig config, final String id, final int imageIndex)
throws FormatException, IOException, ImgIOException
{
statusService.showStatus("Initializing " + img.getName());
final Metadata meta = w.getFormat().createMetadata();
// Get format-specific metadata
Metadata imgMeta = img.getMetadata();
final List<ImageMetadata> imageMeta = new ArrayList<>();
if (imgMeta == null) {
imgMeta = new DefaultMetadata();
imgMeta.createImageMetadata(1);
imageMeta.add(imgMeta.get(0));
}
else {
for (int i = 0; i < imgMeta.getImageCount(); i++) {
imageMeta.add(new DefaultImageMetadata());
}
}
// Create Img-specific ImageMetadata
final int pixelType = utils().makeType(img.firstElement());
// TODO is there some way to consolidate this with the isCompressible
// method?
final CalibratedAxis[] axes = new CalibratedAxis[img.numDimensions()];
img.axes(axes);
final long[] axisLengths = new long[img.numDimensions()];
img.dimensions(axisLengths);
for (final ImageMetadata iMeta : imageMeta) {
iMeta.populate(img.getName(), Arrays.asList(axes), axisLengths,
pixelType, true, false, false, false, true);
// Adjust for RGB information
if (img.getCompositeChannelCount() > 1) {
if (config.imgSaverGetWriteRGB()) {
iMeta.setPlanarAxisCount(3);
}
iMeta.setAxisType(2, Axes.CHANNEL);
// Split Axes.CHANNEL if necessary
if (iMeta.getAxisLength(Axes.CHANNEL) > img.getCompositeChannelCount())
{
iMeta.addAxis(Axes.get("Channel-planes", false), iMeta
.getAxisLength(Axes.CHANNEL) /
img.getCompositeChannelCount());
iMeta.setAxisLength(Axes.CHANNEL, img.getCompositeChannelCount());
}
}
}
// Translate to the output metadata
final Translator t = translatorService.findTranslator(imgMeta, meta, false);
t.translate(imgMeta, imageMeta, meta);
w.setMetadata(meta);
w.setDest(id, imageIndex, config);
}
示例5: translateFormatMetadata
import io.scif.DefaultImageMetadata; //导入依赖的package包/类
@Override
protected void translateFormatMetadata(final io.scif.Metadata source,
final Metadata dest)
{
try {
final TIFFFormat.Metadata tiffMeta = (TIFFFormat.Metadata) //
formatService.getFormatFromClass(TIFFFormat.class).createMetadata();
translatorService.translate(source, tiffMeta, false);
dest.setFirstIFD(tiffMeta.getIfds().get(0));
}
catch (final FormatException e) {
log().error("Failed to generate TIFF data", e);
}
final OMETIFFPlane[][] info = new OMETIFFPlane[source.getImageCount()][];
dest.setPlaneInfo(info);
final List<Integer> samples = new ArrayList<>();
final List<Boolean> adjustedSamples = new ArrayList<>();
dest.samples = samples;
dest.adjustedSamples = adjustedSamples;
dest.createImageMetadata(0);
for (int i = 0; i < source.getImageCount(); i++) {
info[i] = new OMETIFFPlane[(int) source.get(i).getPlaneCount()];
for (int j = 0; j < source.get(i).getPlaneCount(); j++) {
info[i][j] = new OMETIFFPlane();
}
dest.add(new DefaultImageMetadata());
samples.add((int) (source.get(i).isMultichannel() ? source.get(i)
.getAxisLength(Axes.CHANNEL) : 1));
adjustedSamples.add(false);
}
}