Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of getType() API #72

Merged
merged 3 commits into from
May 7, 2024
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
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ Martin Horn, Steffen Jaensch, Lee Kamentsky, Larry Lindsey, Melissa Linkert,
Mark Longair, Brian Northan, Nick Perry, Curtis Rueden, Johannes Schindelin,
Jean-Yves Tinevez and Michael Zinsmaier.</license.copyrightOwners>

<imglib2.version>7.0.0</imglib2.version>
<imglib2-realtransform.version>4.0.3</imglib2-realtransform.version>

<!-- NB: Deploy releases to the SciJava Maven repository. -->
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>
</properties>
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/net/imglib2/labeling/DefaultROIStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import net.imglib2.roi.AbstractIterableRegionOfInterest;
import net.imglib2.roi.IterableRegionOfInterest;
import net.imglib2.roi.RegionOfInterest;
import net.imglib2.type.logic.BitType;

/**
* A relatively conservative strategy suitable for blobby objects - retain the
Expand Down Expand Up @@ -329,6 +330,11 @@ public void move( final double[] displacement )
throw new UnsupportedOperationException( "yet to be implemented" );
}

@Override
public BitType getType()
{
return new BitType();
}
}

@Override
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/net/imglib2/labeling/NativeImgLabeling.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,10 @@ public Cursor< LabelingType< T > > localizingCursor( final Interval interval )

return new LabelingConvertedCursor< I, T >( c, generation, mapping );
}

@Override
public LabelingType< T > getType()
{
return new LabelingType<>( null, mapping, generation );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@ public T get()
return randomAccess.get();
}

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

@Override
public void jumpFwd( final long steps )
{
Expand Down Expand Up @@ -402,6 +408,12 @@ public long size()
return getCachedSize();
}

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

@Override
public T firstElement()
{
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/net/imglib2/roi/BinaryMaskRegionOfInterest.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ public TT get()
return src.get();
}

@Override
public TT getType()
{
return src.getType();
}

@Override
public void fwd()
{
Expand Down Expand Up @@ -215,6 +221,12 @@ public TT firstElement()
return src.get();
}

@Override
public TT getType()
{
return src.getType();
}

@Override
public Object iterationOrder()
{
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/net/imglib2/roi/RegionOfInterest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,10 @@ public interface RegionOfInterest extends RealRandomAccessibleRealInterval< BitT
void move( double displacement, int d );

void move( double[] displacement );

@Override
default BitType getType()
{
return new BitType();
}
}
16 changes: 14 additions & 2 deletions src/main/java/net/imglib2/roi/boundary/Boundary.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Expand Down Expand Up @@ -135,6 +135,12 @@ public RandomAccess< BoolType > randomAccess( final Interval interval )
return randomAccess();
}

@Override
public BoolType getType()
{
return new BoolType();
}

private final class BoundaryIterable extends AbstractWrappedInterval< Interval > implements IterableInterval< Void >
{
BoundaryIterable()
Expand Down Expand Up @@ -177,6 +183,12 @@ public Void firstElement()
{
return cursor().next();
}

@Override
public Void getType()
{
return null;
}
}

private final class BoundaryCursor extends Point implements Cursor< Void >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ public BoolType get()
return type;
}

@Override
public BoolType getType()
{
return type;
}

@Override
public BoundaryRandomAccess4< T > copy()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ public BoolType get()
return type;
}

@Override
public BoolType getType()
{
return type;
}

@Override
public BoundaryRandomAccess8< T > copy()
{
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/net/imglib2/roi/geom/integer/IterableLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ public Cursor< Void > localizingCursor()
return new LineCursor();
}

@Override
public Void getType()
{
return null;
}

private final class LineCursor implements Cursor< Void >
{

Expand Down
18 changes: 18 additions & 0 deletions src/main/java/net/imglib2/roi/labeling/ImgLabeling.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ public LabelingType< T > get()
return type;
}

@Override
public LabelingType< T > getType()
{
return type;
}

@Override
public LabelingConvertedRandomAccess copy()
{
Expand All @@ -191,6 +197,12 @@ public LabelingType< T > get()
return type;
}

@Override
public LabelingType< T > getType()
{
return type;
}

@Override
public LabelingConvertedCursor copy()
{
Expand Down Expand Up @@ -228,6 +240,12 @@ public LabelingType< T > firstElement()
return cursor().next();
}

@Override
public LabelingType< T > getType()
{
return new LabelingType<>( null, mapping, generation );
}

@Override
public Iterator< LabelingType< T > > iterator()
{
Expand Down
26 changes: 19 additions & 7 deletions src/main/java/net/imglib2/roi/labeling/LabelRegion.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class LabelRegion< T > extends PositionableInterval implements Positionab

private final ArrayList< TIntArrayList > itcodes;

private long size;
private long insideSize;

private final RealPoint centerOfMass;

Expand All @@ -93,7 +93,7 @@ public LabelRegion( final LabelRegions< T > regions, final LabelRegionProperties
this.regionProperties = regionProperties;
this.label = label;
expectedGeneration = regionProperties.update();
size = regionProperties.getSize();
insideSize = regionProperties.getSize();
itcodes = regionProperties.getItcodes();
centerOfMass = RealPoint.wrap( regionProperties.getCenterOfMass() );
inside = new LabelRegionIterable();
Expand All @@ -109,7 +109,7 @@ protected LabelRegion( final LabelRegion< T > other )
this.regionProperties = other.regionProperties;
this.label = other.label;
this.expectedGeneration = other.expectedGeneration;
this.size = other.size;
this.insideSize = other.insideSize;
this.itcodes = other.itcodes;
this.centerOfMass = other.centerOfMass;
this.inside = new LabelRegionIterable();
Expand Down Expand Up @@ -153,7 +153,7 @@ private void update()
initialMin[ d ] = bbmin[ d ];
initialMax[ d ] = bbmax[ d ];
}
size = regionProperties.getSize();
insideSize = regionProperties.getSize();
}
}

Expand All @@ -180,6 +180,12 @@ public RandomAccess< BoolType > randomAccess( final Interval interval )
return new OutOfBoundsConstantValue<>( this, new BoolType( false ) );
}

@Override
public BoolType getType()
{
return new BoolType();
}

@Override
public PositionableIterableInterval< Void > inside()
{
Expand Down Expand Up @@ -209,7 +215,7 @@ public LabelRegionCursor localizingCursor()
@Override
public long size()
{
return LabelRegion.this.size();
return LabelRegion.this.insideSize();
}

@Override
Expand All @@ -218,6 +224,12 @@ public Void firstElement()
return null;
}

@Override
public Void getType()
{
return null;
}

@Override
public Object iterationOrder()
{
Expand Down Expand Up @@ -255,10 +267,10 @@ public long max( final int d )
}
}

public long size()
private long insideSize()
{
update();
return size;
return insideSize;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ public BoolType get()
return type;
}

@Override
public BoolType getType()
{
return type;
}

@Override
public LabelRegionRandomAccess< T > copy()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,9 @@ public RandomAccess< B > randomAccess( final Interval interval )
return randomAccess();
}

@Override
public B getType()
{
return type;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,10 @@ public RandomAccess< B > randomAccess( final Interval interval )
{
return randomAccess();
}

@Override
public B getType()
{
return type;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ public B get()
return type;
}

@Override
public B getType()
{
return type;
}

@Override
public MaskPredicateRandomAccess< B > copy()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ public B get()
return type;
}

@Override
public B getType()
{
return type;
}

@Override
public MaskPredicateRealRandomAccess< B > copy()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,9 @@ public RealRandomAccess< B > realRandomAccess( final RealInterval interval )
return realRandomAccess();
}

@Override
public B getType()
{
return type;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,10 @@ public RealRandomAccess< B > realRandomAccess( final RealInterval interval )
{
return realRandomAccess();
}

@Override
public B getType()
{
return type;
}
}
Loading
Loading