Skip to content

Commit 719977c

Browse files
committed
Use Boolean over Bit
Broadened the generics so let's also broaden the wording
1 parent 19946c8 commit 719977c

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

src/main/java/net/imglib2/imagej/RAIToImagePlus.java

+15-15
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,9 @@ public static < T > ImagePlus wrapUnsignedShort(
417417
* @param title the name assigned to the resulting {@link ImagePlus}
418418
* @param service the {@link ExecutorService} used for processing.
419419
* @return an {@link ImagePlus} wrapping {@code img}
420-
* @see #wrapAndScaleBit(RandomAccessibleInterval, String, ExecutorService) for wrapping with scaling.
420+
* @see #wrapAndScaleBoolean(RandomAccessibleInterval, String, ExecutorService) for wrapping with scaling.
421421
*/
422-
public static < B extends BooleanType< B >> ImagePlus wrapBit(
422+
public static < B extends BooleanType< B >> ImagePlus wrapBoolean(
423423
final RandomAccessibleInterval< B > img,
424424
final String title,
425425
final ExecutorService service )
@@ -441,13 +441,13 @@ public static < B extends BooleanType< B >> ImagePlus wrapBit(
441441
* @param img the {@link RandomAccessibleInterval} to wrap
442442
* @param title the name assigned to the resulting {@link ImagePlus}
443443
* @return an {@link ImagePlus} wrapping {@code img}
444-
* @see #wrapAndScaleBit(RandomAccessibleInterval, String) for wrapping with scaling.
444+
* @see #wrapAndScaleBoolean(RandomAccessibleInterval, String) for wrapping with scaling.
445445
*/
446-
public static < B extends BooleanType< B >> ImagePlus wrapBit(
446+
public static < B extends BooleanType< B >> ImagePlus wrapBoolean(
447447
final RandomAccessibleInterval< B > img,
448448
final String title )
449449
{
450-
return wrapBit( img, title, null );
450+
return wrapBoolean( img, title, null );
451451
}
452452

453453
/**
@@ -463,16 +463,16 @@ public static < B extends BooleanType< B >> ImagePlus wrapBit(
463463
* @param title the name assigned to the resulting {@link ImagePlus}
464464
* @param service the {@link ExecutorService} used for processing.
465465
* @return an {@link ImagePlus} wrapping {@code img}
466-
* @see #wrapBit(RandomAccessibleInterval, String, ExecutorService) for wrapping without scaling.
466+
* @see #wrapBoolean(RandomAccessibleInterval, String, ExecutorService) for wrapping without scaling.
467467
*/
468-
public static < B extends BooleanType<B> > ImagePlus wrapAndScaleBit(
468+
public static < B extends BooleanType<B> > ImagePlus wrapAndScaleBoolean(
469469
final RandomAccessibleInterval<B> img,
470470
final String title,
471471
final ExecutorService service )
472472
{
473473
return internalWrap( //
474474
img, //
475-
ImageJVirtualStackUnsignedByte::wrapAndScaleBitType, //
475+
ImageJVirtualStackUnsignedByte::wrapAndScaleBoolean, //
476476
title, //
477477
service //
478478
);
@@ -490,13 +490,13 @@ public static < B extends BooleanType<B> > ImagePlus wrapAndScaleBit(
490490
* @param img the {@link RandomAccessibleInterval} to wrap
491491
* @param title the name assigned to the resulting {@link ImagePlus}
492492
* @return an {@link ImagePlus} wrapping {@code img}
493-
* @see #wrapBit(RandomAccessibleInterval, String) for wrapping without scaling.
493+
* @see #wrapBoolean(RandomAccessibleInterval, String) for wrapping without scaling.
494494
*/
495-
public static < B extends BooleanType<B> > ImagePlus wrapAndScaleBit(
495+
public static < B extends BooleanType<B> > ImagePlus wrapAndScaleBoolean(
496496
final RandomAccessibleInterval<B> img,
497497
final String title )
498498
{
499-
return wrapAndScaleBit( img, title, null );
499+
return wrapAndScaleBoolean( img, title, null );
500500
}
501501

502502
private static <T, U extends NativeType<U>> ImagePlus internalWrap(
@@ -568,9 +568,9 @@ public static ImagePlus wrapVirtualStack(final RandomAccessibleInterval< ? > rai
568568
* @return an {@link ImagePlus} wrapping {@code rai}
569569
* @see ArrayImgToImagePlus
570570
*/
571-
public static ImagePlus wrapVirtualStackAndScaleBitType(final RandomAccessibleInterval< BitType > rai , final String title )
571+
public static <B extends BooleanType<B>> ImagePlus wrapVirtualStackAndScaleBooleanType(final RandomAccessibleInterval< B > rai , final String title )
572572
{
573-
return wrapVirtualStack( rai, title, RAIToImagePlus::createVirtualStackBits );
573+
return wrapVirtualStack( rai, title, RAIToImagePlus::createVirtualStackBools);
574574
}
575575

576576
private static < T > ImagePlus wrapVirtualStack(RandomAccessibleInterval< T > rai, final String title, final Function< RandomAccessibleInterval< T >, ImageJVirtualStack<?>> imageStackWrapper )
@@ -582,9 +582,9 @@ private static < T > ImagePlus wrapVirtualStack(RandomAccessibleInterval< T > ra
582582
return result;
583583
}
584584

585-
private static ImageJVirtualStack<?> createVirtualStackBits(final RandomAccessibleInterval< BitType > sorted )
585+
private static <B extends BooleanType<B>> ImageJVirtualStack<?> createVirtualStackBools(final RandomAccessibleInterval< B > sorted )
586586
{
587-
return ImageJVirtualStackUnsignedByte.wrapAndScaleBitType( sorted );
587+
return ImageJVirtualStackUnsignedByte.wrapAndScaleBoolean( sorted );
588588
}
589589

590590
private static ImageJVirtualStack<?> createVirtualStack(final RandomAccessibleInterval< ? > rai )

src/main/java/net/imglib2/imagej/img/ImageJVirtualStackUnsignedByte.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@
4141
import net.imglib2.converter.readwrite.SamplerConverter;
4242
import net.imglib2.img.basictypeaccess.ByteAccess;
4343
import net.imglib2.type.BooleanType;
44-
import net.imglib2.type.logic.BitType;
4544
import net.imglib2.type.numeric.RealType;
4645
import net.imglib2.type.numeric.integer.UnsignedByteType;
47-
import net.imglib2.util.Util;
4846

4947
import java.util.concurrent.ExecutorService;
5048

@@ -66,7 +64,7 @@ public class ImageJVirtualStackUnsignedByte extends ImageJVirtualStack< Unsigned
6664
return Converters.convert(source, new ToUnsignedByteSamplerConverter( source.getType() ) );
6765
}
6866

69-
public static <B extends BooleanType<B>> ImageJVirtualStackUnsignedByte wrapAndScaleBitType( final RandomAccessibleInterval< B > source )
67+
public static <B extends BooleanType<B>> ImageJVirtualStackUnsignedByte wrapAndScaleBoolean(final RandomAccessibleInterval< B > source )
7068
{
7169
return new ImageJVirtualStackUnsignedByte( Converters.convert(source, new ToBitByteSamplerConverter()) );
7270
}

src/test/java/net/imglib2/imagej/RAIToImagePlusTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public void testPersistenceBits()
233233
{
234234
// setup
235235
final Img< BitType > img = ArrayImgs.bits( 1, 1 );
236-
final ImagePlus imagePlus = RAIToImagePlus.wrapAndScaleBit( img, "test" );
236+
final ImagePlus imagePlus = RAIToImagePlus.wrapAndScaleBoolean( img, "test" );
237237
// process
238238
final ImageProcessor processor = imagePlus.getStack().getProcessor( 1 );
239239
processor.setf( 0, 0, 255 );

0 commit comments

Comments
 (0)