Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions scijava-ops-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@
<scijava-maven-plugin.version>3.0.0</scijava-maven-plugin.version>
<imglib2-mesh.version>1.0.0</imglib2-mesh.version>
<net.imglib2.imglib2-mesh.version>${imglib2-mesh.version}</net.imglib2.imglib2-mesh.version>

<imglib2.version>7.0.1</imglib2.version>
<imglib2-roi.version>0.15.0</imglib2-roi.version>
<imglib2-algorithm.version>0.15.2</imglib2-algorithm.version>
<imglib2-realtransform.version>4.0.3</imglib2-realtransform.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ public void shuffleBlocks(long seed) {
shuffleBlocks();
}

@Override
public T getType() {
return image.getType();
}

@Override
public RandomAccess<T> randomAccess() {
return new ShuffledRandomAccess();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

package org.scijava.ops.image.coloc.pValue;

import java.util.List;
import java.util.Random;
import java.util.function.BiFunction;
import java.util.function.Consumer;
Expand All @@ -39,12 +38,9 @@
import org.scijava.concurrent.Parallelization;
import org.scijava.function.Computers;
import org.scijava.ops.spi.Nullable;
import org.scijava.ops.spi.OpDependency;

import org.scijava.ops.image.coloc.ShuffledView;
import net.imglib2.Cursor;
import net.imglib2.Dimensions;
import net.imglib2.RandomAccess;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.img.Img;
import net.imglib2.type.numeric.RealType;
Expand All @@ -63,7 +59,7 @@
*/
public class DefaultPValue<T extends RealType<T>, U extends RealType<U>>
implements
Computers.Arity6<RandomAccessibleInterval<T>, RandomAccessibleInterval<U>, BiFunction<RandomAccessibleInterval<T>, RandomAccessibleInterval<U>, Double>, Integer, Dimensions, Long, PValueResult>
Computers.Arity6<RandomAccessibleInterval<T>, RandomAccessibleInterval<U>, BiFunction<? super RandomAccessibleInterval<T>, ? super RandomAccessibleInterval<U>, Double>, Integer, Dimensions, Long, PValueResult>
{

/**
Expand All @@ -81,7 +77,7 @@ public class DefaultPValue<T extends RealType<T>, U extends RealType<U>>
public void compute( //
final RandomAccessibleInterval<T> image1, //
final RandomAccessibleInterval<U> image2, //
final BiFunction<RandomAccessibleInterval<T>, RandomAccessibleInterval<U>, Double> op, //
final BiFunction<? super RandomAccessibleInterval<T>, ? super RandomAccessibleInterval<U>, Double> op, //
@Nullable Integer nrRandomizations, //
@Nullable Dimensions psfSize, //
@Nullable Long seed, //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,6 @@ public class Creators<N extends NativeType<N>, L, I extends IntegerType<I>, T ex
type);
};

/**
* @input rai
* @output img
* @implNote op names='create.img, engine.create', priority='0.'
*/
public final Function<RandomAccessibleInterval<T>, Img<T>> imgFromRAI = (
rai) -> imgFromDimsAndType.apply(rai, Util.getTypeFromInterval(rai));

/**
* @input arrayImg
* @output img
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public RealMatrix apply(final IterableRegion<B> input) {
"Only three-dimensional inputs allowed!");

final var output = new BlockRealMatrix(3, 3);
var c = input.localizingCursor();
var c = input.inside().localizingCursor();
var pos = new double[3];
var computedCentroid = new double[3];
centroid.apply(input).localize(computedCentroid);
Expand All @@ -95,7 +95,7 @@ public RealMatrix apply(final IterableRegion<B> input) {
output.setEntry(2, 1, output.getEntry(1, 2));
}

final double size = input.size();
final double size = input.inside().size();
output.setEntry(0, 0, output.getEntry(0, 0) / size);
output.setEntry(0, 1, output.getEntry(0, 1) / size);
output.setEntry(0, 2, output.getEntry(0, 2) / size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void compute(final RandomAccessibleInterval<T> in, //
final List<Long> imiList = new ArrayList<>();

if (mask != null) {
final var c = Regions.iterable(mask).localizingCursor();
final var c = Regions.iterable(mask).inside().localizingCursor();
while (c.hasNext()) {
c.next();
imiList.add(IntervalIndexer.positionToIndex(c, in));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ public void compute( //

// Only iterate seeds that are not excluded by the mask
final var maskRegions = Regions.iterable(mask);
final var seedsMasked = Regions.sample(
(IterableInterval<Void>) maskRegions, seeds);
final var seedsMasked = Regions.sample(maskRegions.inside(), seeds);
final var cursorSeeds = seedsMasked
.localizingCursor();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public interface AbstractImageMomentOp<I extends RealType<I>, O extends RealType
extends Computers.Arity1<RandomAccessibleInterval<I>, O>
{

public void computeMoment(RandomAccessibleInterval<I> input, O output);
void computeMoment(RandomAccessibleInterval<I> input, O output);

/**
* TODO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,14 @@
import java.util.function.BiFunction;
import java.util.function.Function;

import net.imglib2.Cursor;
import net.imglib2.Dimensions;
import net.imglib2.IterableInterval;
import net.imglib2.RandomAccess;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.roi.IterableRegion;
import net.imglib2.roi.Regions;
import net.imglib2.roi.labeling.ImgLabeling;
import net.imglib2.roi.labeling.LabelingType;
import net.imglib2.type.BooleanType;
import net.imglib2.type.numeric.IntegerType;
import net.imglib2.view.Views;

import org.scijava.function.Computers;
import org.scijava.function.Functions;
Expand Down Expand Up @@ -72,24 +68,21 @@ public class MergeLabeling<L, I extends IntegerType<I>, B extends BooleanType<B>
* TODO
*
* @param input1
* @param input1
* @param input2
* @param mask
* @return an {@link ImgLabeling} that combines the labels of {@code input1}
* and {@code input2}
*/
@Override
@SuppressWarnings({ "unchecked", "rawtypes", "hiding" })
public ImgLabeling<L, I> apply( //
final ImgLabeling<L, I> input1, //
final ImgLabeling<L, I> input2, //
@Nullable final RandomAccessibleInterval<B> mask //
) {
final var output = imgLabelingCreator.apply(input1, Views
.iterable(input1.getSource()).firstElement());
final var output = imgLabelingCreator.apply(input1, input1.getSource().firstElement());
if (mask != null) {
final IterableRegion iterable = Regions.iterable(mask);
final var sample = Regions.sample(
(IterableInterval<Void>) iterable, output);
final IterableRegion<B> iterable = Regions.iterable(mask);
final var sample = Regions.sample(iterable.inside(), output);
final var randomAccess = input1.randomAccess();
final var randomAccess2 = input2.randomAccess();
final var cursor = sample.cursor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class OpRegressionTest {

@Test
public void testOpDiscoveryRegression() {
long expected = 1941;
long expected = 1940;
long actual = ops.infos().size();
assertEquals(expected, actual);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private void assertResults(final RandomAccessibleInterval<FloatType> in,
// count labels
Set<Integer> labelSet = new HashSet<>();
for (LabelingType<Integer> pixel : Regions.sample(
(IterableInterval<Void>) regions, out))
regions.inside(), out))
{
labelSet.addAll(pixel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private void assertResults(final RandomAccessibleInterval<FloatType> in,
// count labels
Set<Integer> labelSet = new HashSet<>();
for (LabelingType<Integer> pixel : Regions.sample(
(IterableInterval<Void>) regions, out))
regions.inside(), out))
{
labelSet.addAll(pixel);
}
Expand Down
Loading