本文整理汇总了Java中net.imagej.axis.AxisType类的典型用法代码示例。如果您正苦于以下问题:Java AxisType类的具体用法?Java AxisType怎么用?Java AxisType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AxisType类属于net.imagej.axis包,在下文中一共展示了AxisType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: LongColumn
import net.imagej.axis.AxisType; //导入依赖的package包/类
/**
* Creates columns for a {@link net.imagej.table.Table} that describe the
* positions of the subspaces in a hyperspace
* <p>
* For example, if you've split a {X, Y, Z, C, T} space into {X, Y, Z}, the
* method returns "Channel" and "Time" columns that list the positions of the
* subspaces in C and T.
* </p>
*
* @see Subspace
* @param subspaces the subspaces of a hyperspace.
* @param <T> type of the elements in the spaces.
* @return columns that list the positions of the subspaces.
* @deprecated only used in tests.
*/
@Deprecated
public static <T extends RealType<T> & NativeType<T>> List<LongColumn>
createCoordinateColumns(List<Subspace<T>> subspaces)
{
final List<LongColumn> coordinateColumns = new ArrayList<>();
if (subspaces == null) {
return coordinateColumns;
}
final AxisType[] types = subspaces.get(0).getAxisTypes().toArray(
AxisType[]::new);
final List<long[]> positions = subspaces.stream().map(s -> s.getPosition()
.toArray()).collect(Collectors.toList());
for (int i = 0; i < types.length; i++) {
final AxisType type = types[i];
final LongColumn coordinateColumn = new LongColumn(type.getLabel());
final int index = i;
positions.stream().mapToLong(p -> toConventionalIndex(type, p[index]))
.forEach(coordinateColumn::add);
coordinateColumns.add(coordinateColumn);
}
return coordinateColumns;
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:38,代码来源:ResultUtils.java
示例2: testSplitSubspacesEmptySubspaces
import net.imagej.axis.AxisType; //导入依赖的package包/类
/**
* Test that subspaces is empty, if we try to split into subspaces that don't
* exist in the stack
*/
@Test
public void testSplitSubspacesEmptySubspaces() throws Exception {
// SETUP
final Img<ByteType> img = ArrayImgs.bytes(2, 2);
final ImgPlus<ByteType> imgPlus = new ImgPlus<>(img, "", X_AXIS, Y_AXIS);
final List<AxisType> subspaceTypes = Collections.singletonList(
Axes.CHANNEL);
// EXECUTE
final Stream<Subspace<ByteType>> subspaces = splitSubspaces(imgPlus,
subspaceTypes);
// VERIFY
assertEquals(0, subspaces.count());
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:20,代码来源:HyperstackUtilsTest.java
示例3: testSplitSubspacesNoImgPlusMeta
import net.imagej.axis.AxisType; //导入依赖的package包/类
/**
* Test that subspaces is empty, if we ImgPlus has no metadata about axis
* types
*/
@Test
public void testSplitSubspacesNoImgPlusMeta() throws Exception {
// SETUP
final Img<ByteType> img = ArrayImgs.bytes(2, 2, 2);
final ImgPlus<ByteType> imgPlus = new ImgPlus<>(img, "", BAD_AXIS, BAD_AXIS,
BAD_AXIS);
final List<AxisType> subspaceTypes = Arrays.asList(Axes.X, Axes.Y);
// EXECUTE
final Stream<Subspace<ByteType>> subspaces = splitSubspaces(imgPlus,
subspaceTypes);
// VERIFY
assertEquals(0, subspaces.count());
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:20,代码来源:HyperstackUtilsTest.java
示例4: testSplitSubspacesIdentical
import net.imagej.axis.AxisType; //导入依赖的package包/类
/**
* Test that the subspace stream is identical to the input hyperstack, if
* subspace dimensions are equal
*/
@Test
public void testSplitSubspacesIdentical() throws Exception {
// SETUP
final Img<ByteType> img = ArrayImgs.bytes(2, 3);
final AxisType[] types = new AxisType[] { Axes.X, Axes.Y };
final ImgPlus<ByteType> imgPlus = new ImgPlus<>(img, "", types);
// EXECUTE
final List<Subspace<ByteType>> subspaces = splitSubspaces(imgPlus, Arrays
.asList(types)).collect(Collectors.toList());
// VERIFY
assertEquals(1, subspaces.size());
assertEquals(imgPlus, subspaces.get(0).interval);
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:20,代码来源:HyperstackUtilsTest.java
示例5: testSplit3DSubspacesWith2DImgPlus
import net.imagej.axis.AxisType; //导入依赖的package包/类
@Test
public void testSplit3DSubspacesWith2DImgPlus() throws Exception {
// SETUP
final long height = 3;
final Img<ByteType> img = ArrayImgs.bytes(2, height);
final ImgPlus<ByteType> imgPlus = new ImgPlus<>(img, "", X_AXIS, Y_AXIS);
final List<AxisType> subspaceTypes = Arrays.asList(Axes.X, Axes.Z);
// EXECUTE
final List<Subspace<ByteType>> subspaces = splitSubspaces(imgPlus,
subspaceTypes).collect(Collectors.toList());
// VERIFY
assertEquals(height, subspaces.size());
subspaces.forEach(s -> {
final List<AxisType> resultTypes = s.getAxisTypes().collect(Collectors
.toList());
assertEquals(1, resultTypes.size());
assertEquals(Axes.Y, resultTypes.get(0));
});
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:22,代码来源:HyperstackUtilsTest.java
示例6: testSplitSubspacesMultipleSubspaceTypes
import net.imagej.axis.AxisType; //导入依赖的package包/类
/**
* Test that, for example, if you want a {X, Y, T} subspaces of a {X, Y, Z, T,
* T} hyperstack, the subspaces contain all the time axes. You should get n
* {X, Y, T, T} subspaces, where n is the size of the Z-dimension.
*/
@Test
public void testSplitSubspacesMultipleSubspaceTypes() throws Exception {
// SETUP
final long depth = 5;
final Img<ByteType> img = ArrayImgs.bytes(2, 2, depth, 13, 14);
final ImgPlus<ByteType> imgPlus = new ImgPlus<>(img, "", X_AXIS, Y_AXIS,
Z_AXIS, T_AXIS, T_AXIS);
final List<AxisType> subspaceTypes = Arrays.asList(Axes.X, Axes.Y,
Axes.TIME);
// EXECUTE
final Stream<Subspace<ByteType>> subspaces = splitSubspaces(imgPlus,
subspaceTypes);
// VERIFY
assertEquals(depth, subspaces.count());
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:23,代码来源:HyperstackUtilsTest.java
示例7: testGetSizeDescription
import net.imagej.axis.AxisType; //导入依赖的package包/类
@Test
public void testGetSizeDescription() throws Exception {
final String[] expected = { "Size", "Area", "Volume", "Size" };
final AxisType spatialAxis = Axes.get("Spatial", true);
final DefaultLinearAxis axis = new DefaultLinearAxis(spatialAxis);
final ImgPlus mockImage = mock(ImgPlus.class);
when(mockImage.axis(anyInt())).thenReturn(axis);
for (int i = 0; i < expected.length; i++) {
final int dimensions = i + 1;
when(mockImage.numDimensions()).thenReturn(dimensions);
final String description = ResultUtils.getSizeDescription(mockImage);
assertTrue("Size description is incorrect", expected[i].equals(
description));
}
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:19,代码来源:ResultUtilsTest.java
示例8: testGetExponent
import net.imagej.axis.AxisType; //导入依赖的package包/类
@Test
public void testGetExponent() throws Exception {
final char[] expected = { '\u0000', '\u00B2', '\u00B3', '\u2074', '\u2075',
'\u2076', '\u2077', '\u2078', '\u2079', '\u0000' };
final AxisType spatialAxis = Axes.get("Spatial", true);
final DefaultLinearAxis axis = new DefaultLinearAxis(spatialAxis);
final ImgPlus<?> mockImage = mock(ImgPlus.class);
when(mockImage.axis(anyInt())).thenReturn(axis);
for (int i = 0; i < expected.length; i++) {
final int dimensions = i + 1;
when(mockImage.numDimensions()).thenReturn(dimensions);
final char exponent = ResultUtils.getExponent(mockImage);
assertEquals("Wrong exponent character", expected[i], exponent);
}
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:19,代码来源:ResultUtilsTest.java
示例9: testSpatialAxisStream
import net.imagej.axis.AxisType; //导入依赖的package包/类
@Test
public void testSpatialAxisStream() throws Exception {
// Create a test image that has spatial axes
final DefaultLinearAxis xAxis = new DefaultLinearAxis(Axes.X);
final DefaultLinearAxis tAxis = new DefaultLinearAxis(Axes.TIME);
final DefaultLinearAxis yAxis = new DefaultLinearAxis(Axes.Y);
final long[] dimensions = { 10, 3, 10 };
final Img<DoubleType> img = ArrayImgs.doubles(dimensions);
final ImgPlus<DoubleType> imgPlus = new ImgPlus<>(img, "Test image", xAxis,
tAxis, yAxis);
final List<AxisType> result = Streamers.spatialAxisStream(imgPlus).map(
TypedAxis::type).collect(Collectors.toList());
assertNotNull("Stream should not be null", result);
assertEquals("Wrong number of axes in stream", 2, result.size());
assertEquals("Axes in the stream are in wrong order", Axes.X, result.get(
0));
assertEquals("Axes in the stream are in wrong order", Axes.Y, result.get(
1));
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:22,代码来源:StreamersTest.java
示例10: onEvent
import net.imagej.axis.AxisType; //导入依赖的package包/类
/**
* When a tool creates an overlay, add the overlay/figure combo to an
* {@link OverlayFigureView}.
*/
@EventHandler
protected void onEvent(final FigureCreatedEvent event) {
final ImageDisplay display = event.getDisplay();
if (display != getDisplay()) return; // not this canvas's display
final OverlayView overlay = event.getView();
for (int i = 0; i < display.numDimensions(); i++) {
final AxisType axisType = display.axis(i).type();
if (axisType.isXY()) continue;
if (overlay.getData().dimensionIndex(axisType) < 0) {
overlay.setPosition(display.getLongPosition(axisType), axisType);
}
}
if (drawingView.getSelectedFigures().contains(event.getFigure())) {
overlay.setSelected(true);
}
final OverlayFigureView figureView =
new OverlayFigureView(displayViewer, overlay, event.getFigure());
figureViews.add(figureView);
display.add(overlay);
display.update();
}
开发者ID:imagej,项目名称:imagej-ui-swing,代码行数:27,代码来源:JHotDrawImageCanvas.java
示例11: getAxesIndices
import net.imagej.axis.AxisType; //导入依赖的package包/类
/**
* @param input for which the {@link AxisType}s indices will be determined
* @param axisTypes which will be used to determine the indices
*/
public static synchronized int[] getAxesIndices(final TypedSpace<?> input,
final AxisType[] axisTypes)
{
if (axisTypes == null) return null;
int[] indices = new int[axisTypes.length];
for (int i = 0; i < axisTypes.length; i++) {
indices[i] = input.dimensionIndex(axisTypes[i]);
if (indices[i] == -1) {
// TODO nicer exception handling
throw new IllegalArgumentException(
"AxisType not available in TypedSpace<?>");
}
}
return indices;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:24,代码来源:SliceUtils.java
示例12: getNonPlanarAxisPosition
import net.imagej.axis.AxisType; //导入依赖的package包/类
/**
* Returns the position of the specified {@link AxisType} for the given image
* and plane indices.
*
* @return position of the specified axis type, or 0 if the given axis is
* planar.
*/
public static long getNonPlanarAxisPosition(final Metadata m,
final int imageIndex, final long planeIndex, final AxisType type)
{
final ImageMetadata iMeta = m.get(imageIndex);
int axisIndex = iMeta.getAxisIndex(type);
// Axis is a planar axis
if (axisIndex < iMeta.getPlanarAxisCount()) return 0;
// look up position of the given plane
final long[] position =
rasterToPosition(iMeta.getAxesLengthsNonPlanar(), planeIndex);
// Compute relative index of the desired axis
axisIndex -= iMeta.getPlanarAxisCount();
return position[axisIndex];
}
开发者ID:scifio,项目名称:scifio,代码行数:26,代码来源:FormatTools.java
示例13: getPlaneSize
import net.imagej.axis.AxisType; //导入依赖的package包/类
/** Returns the size in bytes of a w * h tile. */
public static long getPlaneSize(final Metadata m, final int width,
final int height, final int imageIndex)
{
final ImageMetadata iMeta = m.get(imageIndex);
final long[] planeMin = new long[iMeta.getPlanarAxisCount()];
final long[] planeMax = new long[iMeta.getPlanarAxisCount()];
for (int i = 0; i < planeMax.length; i++) {
final AxisType type = iMeta.getAxis(i).type();
if (type == Axes.X) {
planeMax[i] = width;
}
else if (type == Axes.Y) {
planeMax[i] = height;
}
else {
planeMax[i] = iMeta.getAxisLength(type);
}
}
return getPlaneSize(m, planeMin, planeMax, imageIndex);
}
开发者ID:scifio,项目名称:scifio,代码行数:22,代码来源:FormatTools.java
示例14: populateImageMetadata
import net.imagej.axis.AxisType; //导入依赖的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);
}
}
开发者ID:scifio,项目名称:scifio,代码行数:27,代码来源:PlaneSeparatorMetadata.java
示例15: getCurrentFile
import net.imagej.axis.AxisType; //导入依赖的package包/类
@Override
protected void
setSourceHelper(final String source, final SCIFIOConfig config)
{
final String oldFile = getCurrentFile();
if (!source.equals(oldFile) ||
metaCheck() &&
(((DimensionSwapperMetadata) getMetadata()).getOutputOrder() == null || ((DimensionSwapperMetadata) getMetadata())
.getOutputOrder().length != getImageCount()))
{
@SuppressWarnings("unchecked")
final List<AxisType>[] axisTypeList = new ArrayList[getImageCount()];
((DimensionSwapperMetadata) getMetadata()).setOutputOrder(axisTypeList);
// NB: Create our own copy of the Metadata,
// which we can manipulate safely.
// TODO should be a copy method
if (metaCheck()) ((DimensionSwapperMetadata) getMetadata())
.wrap(getParent().getMetadata());
}
}
开发者ID:scifio,项目名称:scifio,代码行数:22,代码来源:DimensionSwapper.java
示例16: reorder
import net.imagej.axis.AxisType; //导入依赖的package包/类
private long reorder(final int imageIndex, final long planeIndex) {
if (!metaCheck()) return planeIndex;
final long[] originalPosition =
FormatTools.rasterToPosition(getMetadata().get(imageIndex)
.getAxesLengthsNonPlanar(), planeIndex);
final List<AxisType> swappedOrder = getDimensionOrder(imageIndex);
final long[] swappedPosition = new long[originalPosition.length];
final long[] lengths = new long[originalPosition.length];
for (int i = 0; i < originalPosition.length; i++) {
final int offset = getMetadata().get(imageIndex).getPlanarAxisCount();
final AxisType type = swappedOrder.get(i + offset);
lengths[i] = getMetadata().get(imageIndex).getAxisLength(type);
swappedPosition[i] =
originalPosition[getMetadata().get(imageIndex).getAxisIndex(type) -
offset];
}
return (int) FormatTools.positionToRaster(lengths, swappedPosition);
}
开发者ID:scifio,项目名称:scifio,代码行数:24,代码来源:DimensionSwapper.java
示例17: getAxisGlobalValue
import net.imagej.axis.AxisType; //导入依赖的package包/类
/**
* Returns the global min or max (based on the provided list) for the given
* image, axis type, and slice for that axis.
*/
private Double getAxisGlobalValue(final int imageIndex, final AxisType type,
final int index, final List<Map<AxisType, double[]>> planarAxisValues)
throws FormatException
{
// FormatTools.assertId(getCurrentFile(), true, 2);
if (index < 0 || index >= getMetadata().get(imageIndex).getAxisLength(type))
{
throw new FormatException("Invalid " + type.getLabel() + " index: " +
index);
}
// check that all planes have been read
if (minMaxDone == null ||
minMaxDone[imageIndex] < getPlaneCount(imageIndex))
{
return null;
}
return getAxisValue(planarAxisValues.get(imageIndex).get(type), index);
}
开发者ID:scifio,项目名称:scifio,代码行数:24,代码来源:MinMaxFilter.java
示例18: testMissingAxes
import net.imagej.axis.AxisType; //导入依赖的package包/类
/** Verify conditions when interrogating non-existent axes. */
@Test
public void testMissingAxes() throws FormatException, IOException {
final Format f = scifio.format().getFormat(id);
final Metadata m = f.createParser().parse(id);
// The X and Y axes exist
assertEquals(m.get(0).getAxisLength(Axes.X), 620);
assertEquals(m.get(0).getAxisLength(Axes.Y), 512);
assertEquals(m.get(0).getAxisIndex(Axes.X), 0);
assertEquals(m.get(0).getAxisIndex(Axes.Y), 1);
// The foo axis does not exist
final AxisType fooAxis = Axes.get("foo");
assertEquals(m.get(0).getAxisLength(fooAxis), 1);
assertEquals(m.get(0).getAxisIndex(fooAxis), -1);
}
开发者ID:scifio,项目名称:scifio,代码行数:18,代码来源:MetadataTest.java
示例19: testSubRegion
import net.imagej.axis.AxisType; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes" })
private void testSubRegion(final ImgFactory factory) throws ImgIOException {
final SCIFIOConfig config = new SCIFIOConfig();
// should get an inner left left 128x128 square
AxisType[] axes = new AxisType[] { Axes.X, Axes.Y };
String[] ranges = new String[] { "128-255", "128-255" };
config.imgOpenerSetRegion(new ImageRegion(axes, ranges));
doTestSubRegion(factory, config, 128 * 128 * 5);
axes = new AxisType[] { Axes.TIME };
ranges = new String[] { "0,2-4:2" };
// should get the first, 3rd and 5th T slices
config.imgOpenerSetRegion(new ImageRegion(axes, ranges));
doTestSubRegion(factory, config, 512 * 512 * 3);
// should get the whole image
config.imgOpenerSetRegion(null);
doTestSubRegion(factory, config, 512 * 512 * 5);
}
开发者ID:scifio,项目名称:scifio,代码行数:20,代码来源:ImgOpenerTest.java
示例20:
import net.imagej.axis.AxisType; //导入依赖的package包/类
/**
* Gets the position per axis of the given plane index, reordering the axes as
* requested.
*
* @param imageIndex TODO
* @param planeIndex The plane to convert to axis coordinates.
* @param metadata TODO
* @param axisTypes The axes whose coordinates are desired. TODO if a type is
* given that is not part of the image, this method gives -1 for that
* axis's position.
* @return TODO
*/
public static long[]
rasterToPosition(final int imageIndex, final long planeIndex,
final Metadata metadata, final AxisType... axisTypes)
{
// FIXME: Move this into SCIFIO core in a utility class.
final long[] nPos =
FormatTools.rasterToPosition(imageIndex, planeIndex, metadata);
final ImageMetadata imageMeta = metadata.get(imageIndex);
final int planarAxisCount = imageMeta.getPlanarAxisCount();
final long[] kPos = new long[axisTypes.length];
for (int i = 0; i < kPos.length; i++) {
final int index = imageMeta.getAxisIndex(axisTypes[i]);
kPos[i] = index < 0 ? -1 : nPos[index - planarAxisCount];
}
return kPos;
}
开发者ID:imagej,项目名称:imagej-omero,代码行数:32,代码来源:OMEROFormat.java
注:本文中的net.imagej.axis.AxisType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论