Search in sources :

Example 11 with Labeling

use of sc.fiji.labkit.ui.labeling.Labeling in project labkit-ui by juglab.

the class LabelingIoAction method open.

private void open(Void ignore, String filename) throws IOException {
    Labeling labeling = serializer.open(filename);
    labelingModel.labeling().set(labeling);
}
Also used : Labeling(sc.fiji.labkit.ui.labeling.Labeling)

Example 12 with Labeling

use of sc.fiji.labkit.ui.labeling.Labeling in project labkit-ui by juglab.

the class SegmentationAsLabelAction method addLabel.

private void addLabel(String selected, int index, RandomAccessibleInterval<ShortType> segmentation) {
    Converter<ShortType, BitType> converter = (in, out) -> out.set(in.get() == index);
    RandomAccessibleInterval<BitType> result = Converters.convert(segmentation, converter, new BitType());
    Holder<Labeling> labelingHolder = labelingModel.labeling();
    addLabel(labelingHolder.get(), "segmented " + selected, result);
    labelingHolder.notifier().notifyListeners();
}
Also used : BitType(net.imglib2.type.logic.BitType) RandomAccess(net.imglib2.RandomAccess) Converter(net.imglib2.converter.Converter) List(java.util.List) Cursor(net.imglib2.Cursor) MenuBar(sc.fiji.labkit.ui.MenuBar) RandomAccessibleInterval(net.imglib2.RandomAccessibleInterval) Labeling(sc.fiji.labkit.ui.labeling.Labeling) LabelingType(net.imglib2.roi.labeling.LabelingType) ImageLabelingModel(sc.fiji.labkit.ui.models.ImageLabelingModel) SegmentationItem(sc.fiji.labkit.ui.models.SegmentationItem) Converters(net.imglib2.converter.Converters) Extensible(sc.fiji.labkit.ui.Extensible) Label(sc.fiji.labkit.ui.labeling.Label) SegmentationResultsModel(sc.fiji.labkit.ui.models.SegmentationResultsModel) Holder(sc.fiji.labkit.ui.models.Holder) ShortType(net.imglib2.type.numeric.integer.ShortType) SegmentationModel(sc.fiji.labkit.ui.models.SegmentationModel) Views(net.imglib2.view.Views) javax.swing(javax.swing) BitType(net.imglib2.type.logic.BitType) ShortType(net.imglib2.type.numeric.integer.ShortType) Labeling(sc.fiji.labkit.ui.labeling.Labeling)

Example 13 with Labeling

use of sc.fiji.labkit.ui.labeling.Labeling in project labkit-ui by juglab.

the class InitialLabeling method openLabeling.

private static Labeling openLabeling(InputImage inputImage, Context context, String filename) throws IOException {
    Labeling open = new LabelingSerializer(context).open(filename);
    fixAxes(open, inputImage);
    return open;
}
Also used : LabelingSerializer(sc.fiji.labkit.ui.labeling.LabelingSerializer) Labeling(sc.fiji.labkit.ui.labeling.Labeling)

Example 14 with Labeling

use of sc.fiji.labkit.ui.labeling.Labeling in project labkit-ui by juglab.

the class MeasureConnectedComponents method run.

@Override
public void run() {
    try {
        Labeling labeling = new LabelingSerializer(context).open(labelingFile.getAbsolutePath());
        table = createTable(labeling, calibratedSize);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : LabelingSerializer(sc.fiji.labkit.ui.labeling.LabelingSerializer) IOException(java.io.IOException) Labeling(sc.fiji.labkit.ui.labeling.Labeling)

Example 15 with Labeling

use of sc.fiji.labkit.ui.labeling.Labeling in project labkit-ui by juglab.

the class ColoredLabelsModel method moveLabel.

public void moveLabel(Label label, int movement) {
    Labeling labeling = model.labeling().get();
    List<Label> oldOrder = new ArrayList<>(labeling.getLabels());
    Function<Label, Double> priority = l -> oldOrder.indexOf(l) + (l == label ? movement + 0.5 * Math.signum(movement) : 0.0);
    labeling.setLabelOrder(Comparator.comparing(priority));
    fireLabelsChanged();
}
Also used : BitType(net.imglib2.type.logic.BitType) Notifier(sc.fiji.labkit.ui.utils.Notifier) IterableRegion(net.imglib2.roi.IterableRegion) ARGBType(net.imglib2.type.numeric.ARGBType) LabelPanel(sc.fiji.labkit.ui.panel.LabelPanel) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) List(java.util.List) Cursor(net.imglib2.Cursor) Labeling(sc.fiji.labkit.ui.labeling.Labeling) Interval(net.imglib2.Interval) FinalInterval(net.imglib2.FinalInterval) Label(sc.fiji.labkit.ui.labeling.Label) Comparator(java.util.Comparator) Label(sc.fiji.labkit.ui.labeling.Label) ArrayList(java.util.ArrayList) Labeling(sc.fiji.labkit.ui.labeling.Labeling)

Aggregations

Labeling (sc.fiji.labkit.ui.labeling.Labeling)26 LabelingType (net.imglib2.roi.labeling.LabelingType)8 Label (sc.fiji.labkit.ui.labeling.Label)8 FinalInterval (net.imglib2.FinalInterval)7 BitType (net.imglib2.type.logic.BitType)7 Test (org.junit.Test)7 Context (org.scijava.Context)7 ImgPlus (net.imagej.ImgPlus)6 Interval (net.imglib2.Interval)6 Cursor (net.imglib2.Cursor)5 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)5 DatasetInputImage (sc.fiji.labkit.ui.inputimage.DatasetInputImage)5 File (java.io.File)4 List (java.util.List)4 Intervals (net.imglib2.util.Intervals)4 ValuePair (net.imglib2.util.ValuePair)4 Views (net.imglib2.view.Views)4 ArrayList (java.util.ArrayList)3 Set (java.util.Set)3 Collectors (java.util.stream.Collectors)3