Search in sources :

Example 16 with DatasetInputImage

use of sc.fiji.labkit.ui.inputimage.DatasetInputImage in project labkit-ui by juglab.

the class ImageLabelingModelTest method testChangeLabelingInterval.

@Test
public void testChangeLabelingInterval() {
    Img<UnsignedByteType> image = ArrayImgs.unsignedBytes(8, 8);
    ImageLabelingModel model = new ImageLabelingModel(new DatasetInputImage(image));
    model.labeling().set(initLabeling(4, 4));
    AffineTransform3D labelTransformation = model.labelTransformation();
    assertArrayEquals(expectedTransform(2.0), labelTransformation.getRowPackedCopy(), 0.0);
    // process
    model.labeling().set(initLabeling(2, 2));
    assertArrayEquals(expectedTransform(4.0), labelTransformation.getRowPackedCopy(), 0.0);
}
Also used : DatasetInputImage(sc.fiji.labkit.ui.inputimage.DatasetInputImage) UnsignedByteType(net.imglib2.type.numeric.integer.UnsignedByteType) AffineTransform3D(net.imglib2.realtransform.AffineTransform3D) Test(org.junit.Test)

Example 17 with DatasetInputImage

use of sc.fiji.labkit.ui.inputimage.DatasetInputImage in project labkit-ui by juglab.

the class CziOpener method openInputImage.

private DatasetInputImage openInputImage(String filename, String labelingFilename, int fullres, int series) {
    ImgPlus<ARGBType> image = Parallelization.runMultiThreaded(() -> openImage(filename, fullres, series));
    DatasetInputImage result = new DatasetInputImage(image);
    result.setDefaultLabelingFilename(labelingFilename);
    return result;
}
Also used : DatasetInputImage(sc.fiji.labkit.ui.inputimage.DatasetInputImage) ARGBType(net.imglib2.type.numeric.ARGBType)

Example 18 with DatasetInputImage

use of sc.fiji.labkit.ui.inputimage.DatasetInputImage in project labkit-ui by juglab.

the class CziOpener method openResolutionPyramid.

private static DatasetInputImage openResolutionPyramid(String filename, String labelingFilename, List<Integer> selectedSectionIndices) {
    int fullres = selectedSectionIndices.get(0);
    List<ImgPlus<ARGBType>> pyramid = selectedSectionIndices.stream().map(series -> openCachedImage(filename, fullres, series)).collect(Collectors.toList());
    AbstractSource<ARGBType> source = new ResolutionPyramidSource<>(pyramid, new ARGBType(), "source");
    BdvShowable showable = BdvShowable.wrap(source);
    ImgPlus<? extends NumericType<?>> imageForSegmentation = pyramid.get(2);
    imageForSegmentation.setSource(filename);
    DatasetInputImage result = new DatasetInputImage(imageForSegmentation, showable);
    result.setDefaultLabelingFilename(labelingFilename);
    return result;
}
Also used : ZeissCZIReader(loci.formats.in.ZeissCZIReader) Parallelization(net.imglib2.parallel.Parallelization) ImgPlus(net.imagej.ImgPlus) ImageReader(loci.formats.ImageReader) ARGBType(net.imglib2.type.numeric.ARGBType) Axes(net.imagej.axis.Axes) OptionalInt(java.util.OptionalInt) JPEGReader(loci.formats.in.JPEGReader) ValuePair(net.imglib2.util.ValuePair) DiskCachedCellImgOptions(net.imglib2.cache.img.DiskCachedCellImgOptions) Intervals(net.imglib2.util.Intervals) Cursor(net.imglib2.Cursor) CellImgFactory(net.imglib2.img.cell.CellImgFactory) ClassList(loci.formats.ClassList) RandomAccessibleInterval(net.imglib2.RandomAccessibleInterval) DefaultLinearAxis(net.imagej.axis.DefaultLinearAxis) NativeType(net.imglib2.type.NativeType) AxisType(net.imagej.axis.AxisType) DiskCachedCellImgFactory(net.imglib2.cache.img.DiskCachedCellImgFactory) CellLoader(net.imglib2.cache.img.CellLoader) Views(net.imglib2.view.Views) CalibratedAxis(net.imagej.axis.CalibratedAxis) IntFunction(java.util.function.IntFunction) FormatException(loci.formats.FormatException) CancellationException(java.util.concurrent.CancellationException) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) Consumer(java.util.function.Consumer) ProgressWriter(bdv.export.ProgressWriter) NumericType(net.imglib2.type.numeric.NumericType) UNITS(ome.units.UNITS) List(java.util.List) Stream(java.util.stream.Stream) DatasetInputImage(sc.fiji.labkit.ui.inputimage.DatasetInputImage) MetadataTools(loci.formats.MetadataTools) PositiveInteger(ome.xml.model.primitives.PositiveInteger) CellGrid(net.imglib2.img.cell.CellGrid) BdvShowable(sc.fiji.labkit.ui.bdv.BdvShowable) Length(ome.units.quantity.Length) IFormatReader(loci.formats.IFormatReader) ParallelUtils(sc.fiji.labkit.ui.utils.ParallelUtils) AbstractSource(bdv.util.AbstractSource) IMetadata(loci.formats.meta.IMetadata) Img(net.imglib2.img.Img) ImageSelectionDialog(sc.fiji.labkit.ui.plugin.ui.ImageSelectionDialog) javax.swing(javax.swing) BdvShowable(sc.fiji.labkit.ui.bdv.BdvShowable) ImgPlus(net.imagej.ImgPlus) DatasetInputImage(sc.fiji.labkit.ui.inputimage.DatasetInputImage) ARGBType(net.imglib2.type.numeric.ARGBType)

Example 19 with DatasetInputImage

use of sc.fiji.labkit.ui.inputimage.DatasetInputImage in project labkit-ui by juglab.

the class LabkitPlugin method run.

@Override
public void run() {
    DatasetInputImage input = new DatasetInputImage(dataset);
    LabkitFrame.showForImage(context, input);
}
Also used : DatasetInputImage(sc.fiji.labkit.ui.inputimage.DatasetInputImage)

Example 20 with DatasetInputImage

use of sc.fiji.labkit.ui.inputimage.DatasetInputImage in project labkit-ui by juglab.

the class LabeledImage method openInputImage.

private DatasetInputImage openInputImage() {
    try {
        DatasetIOService datasetIOService = context.service(DatasetIOService.class);
        Dataset dataset = datasetIOService.open(imageFile);
        return new DatasetInputImage(dataset);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : DatasetIOService(io.scif.services.DatasetIOService) DatasetInputImage(sc.fiji.labkit.ui.inputimage.DatasetInputImage) Dataset(net.imagej.Dataset) IOException(java.io.IOException)

Aggregations

DatasetInputImage (sc.fiji.labkit.ui.inputimage.DatasetInputImage)25 Context (org.scijava.Context)10 Test (org.junit.Test)7 UnsignedByteType (net.imglib2.type.numeric.integer.UnsignedByteType)6 ImagePlus (ij.ImagePlus)5 DefaultSegmentationModel (sc.fiji.labkit.ui.models.DefaultSegmentationModel)5 ShortType (net.imglib2.type.numeric.integer.ShortType)4 ValuePair (net.imglib2.util.ValuePair)4 Labeling (sc.fiji.labkit.ui.labeling.Labeling)4 ImageLabelingModel (sc.fiji.labkit.ui.models.ImageLabelingModel)4 SegmentationModel (sc.fiji.labkit.ui.models.SegmentationModel)4 ImgPlus (net.imagej.ImgPlus)3 AxisType (net.imagej.axis.AxisType)3 SegmentationItem (sc.fiji.labkit.ui.models.SegmentationItem)3 File (java.io.File)2 IOException (java.io.IOException)2 ARGBType (net.imglib2.type.numeric.ARGBType)2 ProgressWriter (bdv.export.ProgressWriter)1 ProgressWriterConsole (bdv.export.ProgressWriterConsole)1 AbstractSource (bdv.util.AbstractSource)1