Skip to content
Snippets Groups Projects
Commit b487b5af authored by Tobias Pietzsch's avatar Tobias Pietzsch
Browse files

Revise BoxRealRandomAccessible to work with any RealInterval

parent 8b6b8c2f
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,7 @@ import bdv.tools.boundingbox.BoundingBoxOverlay.BoundingBoxOverlaySource; ...@@ -49,6 +49,7 @@ import bdv.tools.boundingbox.BoundingBoxOverlay.BoundingBoxOverlaySource;
import bdv.tools.brightness.RealARGBColorConverterSetup; import bdv.tools.brightness.RealARGBColorConverterSetup;
import bdv.tools.brightness.SetupAssignments; import bdv.tools.brightness.SetupAssignments;
import bdv.tools.transformation.TransformedSource; import bdv.tools.transformation.TransformedSource;
import bdv.util.ModifiableInterval;
import bdv.util.RealRandomAccessibleSource; import bdv.util.RealRandomAccessibleSource;
import bdv.viewer.DisplayMode; import bdv.viewer.DisplayMode;
import bdv.viewer.SourceAndConverter; import bdv.viewer.SourceAndConverter;
...@@ -66,6 +67,8 @@ public class BoundingBoxDialog extends JDialog ...@@ -66,6 +67,8 @@ public class BoundingBoxDialog extends JDialog
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
protected final ModifiableInterval interval;
protected final BoxRealRandomAccessible< UnsignedShortType > boxRealRandomAccessible; protected final BoxRealRandomAccessible< UnsignedShortType > boxRealRandomAccessible;
protected final BoxSelectionPanel boxSelectionPanel; protected final BoxSelectionPanel boxSelectionPanel;
...@@ -106,7 +109,8 @@ public class BoundingBoxDialog extends JDialog ...@@ -106,7 +109,8 @@ public class BoundingBoxDialog extends JDialog
// create a procedural RealRandomAccessible that will render the bounding box // create a procedural RealRandomAccessible that will render the bounding box
final UnsignedShortType insideValue = new UnsignedShortType( 1000 ); // inside the box pixel value is 1000 final UnsignedShortType insideValue = new UnsignedShortType( 1000 ); // inside the box pixel value is 1000
final UnsignedShortType outsideValue = new UnsignedShortType( 0 ); // outside is 0 final UnsignedShortType outsideValue = new UnsignedShortType( 0 ); // outside is 0
boxRealRandomAccessible = new BoxRealRandomAccessible<>( initialInterval, insideValue, outsideValue ); interval = new ModifiableInterval( initialInterval );
boxRealRandomAccessible = new BoxRealRandomAccessible<>( interval, insideValue, outsideValue );
// create a bdv.viewer.Source providing data from the bbox RealRandomAccessible // create a bdv.viewer.Source providing data from the bbox RealRandomAccessible
final RealRandomAccessibleSource< UnsignedShortType > boxSource = new RealRandomAccessibleSource< UnsignedShortType >( boxRealRandomAccessible, new UnsignedShortType(), "selection" ) final RealRandomAccessibleSource< UnsignedShortType > boxSource = new RealRandomAccessibleSource< UnsignedShortType >( boxRealRandomAccessible, new UnsignedShortType(), "selection" )
...@@ -114,7 +118,7 @@ public class BoundingBoxDialog extends JDialog ...@@ -114,7 +118,7 @@ public class BoundingBoxDialog extends JDialog
@Override @Override
public Interval getInterval( final int t, final int level ) public Interval getInterval( final int t, final int level )
{ {
return boxRealRandomAccessible.getInterval(); return interval;
} }
}; };
...@@ -142,12 +146,12 @@ public class BoundingBoxDialog extends JDialog ...@@ -142,12 +146,12 @@ public class BoundingBoxDialog extends JDialog
@Override @Override
public Interval getInterval() public Interval getInterval()
{ {
return boxRealRandomAccessible.getInterval(); return interval;
} }
} ); } );
// create a JPanel with sliders to modify the bounding box interval (boxRealRandomAccessible.getInterval()) // create a JPanel with sliders to modify the bounding box interval (boxRealRandomAccessible.getInterval())
boxSelectionPanel = new BoxSelectionPanel( boxRealRandomAccessible.getInterval(), rangeInterval ); boxSelectionPanel = new BoxSelectionPanel( interval, rangeInterval );
boxSelectionPanel.addSelectionUpdateListener( new BoxSelectionPanel.SelectionUpdateListener() // listen for updates on the bbox to trigger repainting boxSelectionPanel.addSelectionUpdateListener( new BoxSelectionPanel.SelectionUpdateListener() // listen for updates on the bbox to trigger repainting
{ {
@Override @Override
......
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
*/ */
package bdv.tools.boundingbox; package bdv.tools.boundingbox;
import bdv.util.ModifiableInterval;
import net.imglib2.Interval;
import net.imglib2.RealInterval; import net.imglib2.RealInterval;
import net.imglib2.RealPoint; import net.imglib2.RealPoint;
import net.imglib2.RealRandomAccess; import net.imglib2.RealRandomAccess;
...@@ -43,13 +41,13 @@ public class BoxRealRandomAccessible< T extends Type< T > > implements RealRando ...@@ -43,13 +41,13 @@ public class BoxRealRandomAccessible< T extends Type< T > > implements RealRando
{ {
private final int n; private final int n;
private final ModifiableInterval interval; private final RealInterval interval;
private final T insideValue; private final T insideValue;
private final T outsideValue; private final T outsideValue;
public BoxRealRandomAccessible( final ModifiableInterval interval, final T insideValue, final T outsideValue ) public BoxRealRandomAccessible( final RealInterval interval, final T insideValue, final T outsideValue )
{ {
n = interval.numDimensions(); n = interval.numDimensions();
this.interval = interval; this.interval = interval;
...@@ -57,14 +55,6 @@ public class BoxRealRandomAccessible< T extends Type< T > > implements RealRando ...@@ -57,14 +55,6 @@ public class BoxRealRandomAccessible< T extends Type< T > > implements RealRando
this.outsideValue = outsideValue.copy(); this.outsideValue = outsideValue.copy();
} }
public BoxRealRandomAccessible( final Interval interval, final T insideValue, final T outsideValue )
{
n = interval.numDimensions();
this.interval = new ModifiableInterval( interval );
this.insideValue = insideValue.copy();
this.outsideValue = outsideValue.copy();
}
@Override @Override
public int numDimensions() public int numDimensions()
{ {
...@@ -114,7 +104,7 @@ public class BoxRealRandomAccessible< T extends Type< T > > implements RealRando ...@@ -114,7 +104,7 @@ public class BoxRealRandomAccessible< T extends Type< T > > implements RealRando
return new Access(); return new Access();
} }
public ModifiableInterval getInterval() public RealInterval getInterval()
{ {
return interval; return interval;
} }
......
...@@ -36,7 +36,7 @@ public class ModifiableInterval extends AbstractInterval ...@@ -36,7 +36,7 @@ public class ModifiableInterval extends AbstractInterval
{ {
public ModifiableInterval( final int numDimensions ) public ModifiableInterval( final int numDimensions )
{ {
super( new long[ numDimensions ], new long[ numDimensions ] ); super( numDimensions );
} }
public ModifiableInterval( final Interval interval ) public ModifiableInterval( final Interval interval )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment