use of sc.fiji.labkit.ui.labeling.Labeling in project labkit-ui by juglab.
the class TrainableSegmentationSegmenterTest method initLabeling.
private Labeling initLabeling() {
Labeling labeling = Labeling.createEmpty(Arrays.asList("a", "b"), new FinalInterval(2, 1, 2));
RandomAccess<LabelingType<Label>> ra = labeling.randomAccess();
ra.setPosition(new long[] { 0, 0, 0 });
ra.get().add(labeling.getLabel("a"));
ra.setPosition(new long[] { 1, 0, 0 });
ra.get().add(labeling.getLabel("b"));
return labeling;
}
use of sc.fiji.labkit.ui.labeling.Labeling in project labkit-ui by juglab.
the class SegmentationUseCaseTest method addLabels.
private void addLabels(ImageLabelingModel imageLabelingModel) {
Labeling labeling = imageLabelingModel.labeling().get();
RandomAccess<LabelingType<Label>> ra = labeling.randomAccess();
ra.setPosition(new long[] { 0, 0 });
ra.get().add(labeling.getLabel("foreground"));
ra.setPosition(new long[] { 0, 1 });
ra.get().add(labeling.getLabel("background"));
}
use of sc.fiji.labkit.ui.labeling.Labeling in project labkit-ui by juglab.
the class SegmentationUseCaseTest method getLabeling.
private Labeling getLabeling() {
List<String> labels = Arrays.asList("b", "f");
Interval interval = new FinalInterval(2, 2);
Labeling labeling = Labeling.createEmpty(labels, interval);
RandomAccess<LabelingType<Label>> ra = labeling.randomAccess();
ra.setPosition(new long[] { 0, 0 });
ra.get().add(labeling.getLabel("f"));
ra.setPosition(new long[] { 1, 0 });
ra.get().add(labeling.getLabel("b"));
ra.setPosition(new long[] { 0, 1 });
ra.get().add(labeling.getLabel("b"));
ra.setPosition(new long[] { 1, 1 });
ra.get().add(labeling.getLabel("b"));
return labeling;
}
use of sc.fiji.labkit.ui.labeling.Labeling in project labkit-ui by juglab.
the class FloodFillTest method test3.
@Test
public void test3() {
Labeling labeling = Labeling.fromImgLabeling(exampleImgLabeling());
final Point seed = new Point(2, 2);
Label a = labeling.getLabel("a");
Label b = labeling.getLabel("b");
Label c = labeling.getLabel("c");
c.setVisible(false);
Label ab = labeling.addLabel("ab");
final Consumer<Set<Label>> operation = l -> l.add(ab);
FloodFill.doFloodFillOnActiveLabels((RandomAccessibleInterval) labeling, seed, operation);
assertLabelEqualsInterval(labeling, intervalA, a);
assertLabelEqualsInterval(labeling, intervalB, b);
assertLabelEqualsInterval(labeling, intervalC, c);
assertLabelEqualsInterval(labeling, intervalAintersectB, ab);
}
use of sc.fiji.labkit.ui.labeling.Labeling in project labkit-ui by juglab.
the class LabeledImage method snapshot.
/**
* Returns an up to date {@link ImageLabelingModel}. But doesn't guarantee for
* changes to be tracked, or to keep the reference.
*/
public ImageLabelingModel snapshot() {
if (imageLabelingModel != null)
return imageLabelingModel;
DatasetInputImage inputImage = openInputImage();
inputImage.setDefaultLabelingFilename(modifiedLabelingFile);
Labeling labeling = openOrEmptyLabeling(storedIn.get(), inputImage.imageForSegmentation());
ImageLabelingModel imageLabelingModel = new ImageLabelingModel(inputImage);
imageLabelingModel.labeling().set(labeling);
return imageLabelingModel;
}
Aggregations