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);
}
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();
}
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;
}
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();
}
}
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();
}
Aggregations