Skip to content

Commit

Permalink
Merge pull request #281 from saalfeldlab/update-label-n5-dependencies
Browse files Browse the repository at this point in the history
Update label multiset and N5 dependencies
  • Loading branch information
hanslovsky committed Aug 5, 2019
2 parents 7978436 + 6423817 commit d5da29e
Show file tree
Hide file tree
Showing 18 changed files with 193 additions and 187 deletions.
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@
<groupId>org.scijava</groupId>
<artifactId>scijava-common</artifactId>
</dependency>
<dependency>
<groupId>org.janelia.saalfeldlab</groupId>
<artifactId>n5-label-multisets</artifactId>
<version>0.4.1</version>
</dependency>
<dependency>
<groupId>sc.fiji</groupId>
<artifactId>bigdataviewer-core</artifactId>
Expand Down Expand Up @@ -77,6 +72,11 @@
<groupId>net.imglib2</groupId>
<artifactId>imglib2-realtransform</artifactId>
</dependency>
<dependency>
<groupId>net.imglib2</groupId>
<artifactId>imglib2-label-multisets</artifactId>
<version>0.8.2</version>
</dependency>
<dependency>
<groupId>sc.fiji</groupId>
<artifactId>bigdataviewer-vistools</artifactId>
Expand All @@ -94,17 +94,17 @@
<dependency>
<groupId>org.janelia.saalfeldlab</groupId>
<artifactId>n5</artifactId>
<version>2.0.2</version>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.janelia.saalfeldlab</groupId>
<artifactId>n5-hdf5</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.janelia.saalfeldlab</groupId>
<artifactId>n5-imglib2</artifactId>
<version>3.0.0</version>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>org.janelia.saalfeldlab</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.janelia.saalfeldlab.n5.DatasetAttributes;
import org.janelia.saalfeldlab.n5.N5Reader;
import org.janelia.saalfeldlab.n5.N5Writer;
import org.janelia.saalfeldlab.n5.imglib2.N5LabelMultisets;
import org.janelia.saalfeldlab.n5.imglib2.N5Utils;
import org.janelia.saalfeldlab.paintera.composition.ARGBCompositeAlphaAdd;
import org.janelia.saalfeldlab.paintera.composition.ARGBCompositeAlphaYCbCr;
Expand Down Expand Up @@ -98,7 +99,6 @@
import net.imglib2.converter.ARGBCompositeColorConverter;
import net.imglib2.realtransform.AffineTransform3D;
import net.imglib2.type.NativeType;
import net.imglib2.type.label.LabelUtils;
import net.imglib2.type.numeric.IntegerType;
import net.imglib2.type.numeric.RealType;
import net.imglib2.type.volatiles.AbstractVolatileRealType;
Expand Down Expand Up @@ -739,7 +739,7 @@ private static <I extends IntegerType<I> & NativeType<I>> void findMaxId(
? N5Helpers.getFinestLevelJoinWithGroup(reader, group)
: group;
final boolean isLabelMultiset = N5Helpers.getBooleanAttribute(reader, dataset, N5Helpers.IS_LABEL_MULTISET_KEY, false);
final CachedCellImg<I, ?> img = isLabelMultiset ? (CachedCellImg<I, ?>) (CachedCellImg) LabelUtils.openVolatile(reader, dataset) : (CachedCellImg<I, ?>) N5Utils.open(reader, dataset);
final CachedCellImg<I, ?> img = isLabelMultiset ? (CachedCellImg<I, ?>) (CachedCellImg) N5LabelMultisets.openLabelMultiset(reader, dataset) : N5Utils.open(reader, dataset);
final int[] blockSize = new int[img.numDimensions()];
img.getCellGrid().cellDimensions(blockSize);
final List<Interval> blocks = Grids.collectAllContainedIntervals(img.getCellGrid().getImgDimensions(), blockSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private static final class SectionInfo

private static final Color MASK_COLOR = Color.web("00CCFF");

private static final Predicate<UnsignedLongType> FOREGROUND_CHECK = t -> Label.regular(t.get()) && t.get() != Label.BACKGROUND;
private static final Predicate<UnsignedLongType> FOREGROUND_CHECK = t -> Label.isForeground(t.get());

private final MaskedSource<D, ?> source;
private final LabelSourceState<D, ?> sourceState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void applyMask()

}

private static final Predicate<UnsignedLongType> FOREGROUND_CHECK = t -> Label.regular(t.get()) && t.get() != Label.BACKGROUND;
private static final Predicate<UnsignedLongType> FOREGROUND_CHECK = t -> Label.isForeground(t.get());

private final ViewerPanelFX viewer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public String toString()
}
}

private static final Predicate<UnsignedLongType> FOREGROUND_CHECK = t -> Label.regular(t.get()) && t.get() != Label.BACKGROUND;
private static final Predicate<UnsignedLongType> FOREGROUND_CHECK = t -> Label.isForeground(t.get());

private final SourceInfo sourceInfo;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
import java.nio.file.Paths;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
import java.util.function.BiConsumer;
import java.util.function.Supplier;

import net.imglib2.cache.img.CachedCellImg;
import org.janelia.saalfeldlab.paintera.data.DataSource;
import org.janelia.saalfeldlab.paintera.data.mask.persist.PersistCanvas;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.imglib2.img.cell.AbstractCellImg;
import net.imglib2.type.NativeType;
import net.imglib2.type.label.FromIntegerTypeConverter;
Expand All @@ -19,10 +22,6 @@
import net.imglib2.type.numeric.integer.UnsignedLongType;
import net.imglib2.type.volatiles.AbstractVolatileRealType;
import net.imglib2.type.volatiles.VolatileUnsignedLongType;
import org.janelia.saalfeldlab.paintera.data.DataSource;
import org.janelia.saalfeldlab.paintera.data.mask.persist.PersistCanvas;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Masks
{
Expand Down Expand Up @@ -204,12 +203,12 @@ public static MaskedSource<LabelMultisetType, VolatileLabelMultisetType> fromLab
}
}

final LabelMultisetType defaultValue = FromIntegerTypeConverter.geAppropriateType();
final LabelMultisetType defaultValue = FromIntegerTypeConverter.getAppropriateType();
new FromIntegerTypeConverter<UnsignedLongType>().convert(new UnsignedLongType(Label.INVALID), defaultValue);

final LabelMultisetType type = FromIntegerTypeConverter.geAppropriateType();
final LabelMultisetType type = FromIntegerTypeConverter.getAppropriateType();
new FromIntegerTypeConverter<UnsignedLongType>().convert(new UnsignedLongType(Label.OUTSIDE), defaultValue);
final VolatileLabelMultisetType vtype = FromIntegerTypeConverter.geAppropriateVolatileType();
final VolatileLabelMultisetType vtype = FromIntegerTypeConverter.getAppropriateVolatileType();
new FromIntegerTypeConverter<UnsignedLongType>().convert(new UnsignedLongType(Label.OUTSIDE), defaultValue);
vtype.setValid(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import java.util.function.BiPredicate;
import java.util.function.Predicate;

import org.janelia.saalfeldlab.paintera.data.mask.PickOne.PickAndConvert;

import net.imglib2.converter.Converter;
import net.imglib2.type.label.FromIntegerTypeConverter;
import net.imglib2.type.label.LabelMultisetType;
import net.imglib2.type.numeric.IntegerType;
import net.imglib2.util.Triple;
import org.janelia.saalfeldlab.paintera.data.mask.PickOne.PickAndConvert;

public class PickOneLabelMultisetType<M extends IntegerType<M>>
implements PickOne.PickAndConvert<LabelMultisetType, M, M, LabelMultisetType>
Expand All @@ -27,7 +28,7 @@ public PickOneLabelMultisetType(final Predicate<M> pickThird, final BiPredicate<
super();
this.pickThird = pickThird;
this.pickSecond = pickSecond;
this.scalarValue = FromIntegerTypeConverter.geAppropriateType();
this.scalarValue = FromIntegerTypeConverter.getAppropriateType();
this.converter = new FromIntegerTypeConverter<>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import java.util.function.BiPredicate;
import java.util.function.Predicate;

import org.janelia.saalfeldlab.paintera.data.mask.PickOne.PickAndConvert;

import net.imglib2.Volatile;
import net.imglib2.converter.Converter;
import net.imglib2.type.label.FromIntegerTypeConverter;
import net.imglib2.type.label.LabelMultisetType;
import net.imglib2.type.label.VolatileLabelMultisetType;
import net.imglib2.type.numeric.IntegerType;
import net.imglib2.util.Triple;
import org.janelia.saalfeldlab.paintera.data.mask.PickOne.PickAndConvert;

public class PickOneVolatileLabelMultisetType<M extends IntegerType<M>, VM extends Volatile<M>>
implements PickOne.PickAndConvert<VolatileLabelMultisetType, VM, VM, VolatileLabelMultisetType>
Expand All @@ -29,7 +30,7 @@ public PickOneVolatileLabelMultisetType(final Predicate<M> pickThird, final BiPr
super();
this.pickThird = pickThird;
this.pickSecond = pickSecond;
this.scalarValue = FromIntegerTypeConverter.geAppropriateVolatileType();
this.scalarValue = FromIntegerTypeConverter.getAppropriateVolatileType();
this.converter = new FromIntegerTypeConverter<>();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.janelia.saalfeldlab.paintera.data.n5;

import java.util.Iterator;

import net.imglib2.converter.Converter;
import net.imglib2.type.label.FromIntegerTypeConverter;
import net.imglib2.type.label.Label;
import net.imglib2.type.label.LabelMultisetType;
import net.imglib2.type.numeric.integer.UnsignedLongType;
import net.imglib2.util.Pair;

import java.util.Iterator;

/**
* @author Philipp Hanslovsky
*
Expand All @@ -26,7 +26,7 @@ public class BackgroundCanvasIterable implements Iterable<LabelMultisetType> {
* @param backgroundAndCanvas {@link Iterable} over pairs of background ({@link LabelMultisetType})
* and canvas ({@link UnsignedLongType}).
*/
public BackgroundCanvasIterable(Iterable<? extends Pair<LabelMultisetType, UnsignedLongType>> backgroundAndCanvas) {
public BackgroundCanvasIterable(final Iterable<? extends Pair<LabelMultisetType, UnsignedLongType>> backgroundAndCanvas) {
this.backgroundAndCanvas = backgroundAndCanvas;
}

Expand All @@ -38,7 +38,7 @@ public Iterator<LabelMultisetType> iterator() {

final Converter<UnsignedLongType, LabelMultisetType> conv = new FromIntegerTypeConverter<>();

final LabelMultisetType type = FromIntegerTypeConverter.geAppropriateType();
final LabelMultisetType type = FromIntegerTypeConverter.getAppropriateType();

@Override
public boolean hasNext() {
Expand Down
Loading

0 comments on commit d5da29e

Please sign in to comment.