use of sc.fiji.labkit.ui.models.ImageLabelingModel in project labkit-ui by juglab.
the class ChangingImageSegmentationComponentDemo method onChangeImageButtonClicked.
private static void onChangeImageButtonClicked(SegmentationModel segmentationModel) {
final ImagePlus imp = new ImagePlus("https://imagej.nih.gov/ij/images/apple.tif");
ImageLabelingModel model = segmentationModel.imageLabelingModel();
ImgPlus<?> image = VirtualStackAdapter.wrap(imp);
DatasetInputImage datasetInputImage = new DatasetInputImage(image);
model.showable().set(datasetInputImage.showable());
model.imageForSegmentation().set(datasetInputImage.imageForSegmentation());
model.labeling().set(InitialLabeling.initialLabeling(SingletonContext.getInstance(), datasetInputImage));
}
use of sc.fiji.labkit.ui.models.ImageLabelingModel in project labkit-ui by juglab.
the class CustomizedSegmentationComponentDemo method initActions.
private void initActions() {
final Holder<SegmentationItem> selectedSegmenter = segmentationModel.segmenterList().selectedSegmenter();
final ImageLabelingModel labelingModel = segmentationModel.imageLabelingModel();
new TrainClassifier(extensible, segmentationModel.segmenterList());
new ClassifierSettingsAction(extensible, segmentationModel.segmenterList());
new ClassifierIoAction(extensible, segmentationModel.segmenterList());
new LabelingIoAction(extensible, labelingModel);
new AddLabelingIoAction(extensible, labelingModel.labeling());
new SegmentationExportAction(extensible, labelingModel);
new ResetViewAction(extensible, labelingModel);
new BatchSegmentAction(extensible, selectedSegmenter);
new SegmentationAsLabelAction(extensible, segmentationModel);
new BitmapImportExportAction(extensible, labelingModel);
new LabelEditAction(extensible, false, new ColoredLabelsModel(labelingModel));
MeasureConnectedComponents.addAction(extensible, labelingModel);
labelingComponent.addShortcuts(extensible.getShortCuts());
}
use of sc.fiji.labkit.ui.models.ImageLabelingModel in project labkit-ui by juglab.
the class CustomizedSegmentationComponentDemo method onSaveResultsClicked.
private void onSaveResultsClicked(ActionEvent actionEvent) {
SegmentationItem selectedSegmenter = segmentationModel.segmenterList().selectedSegmenter().get();
if (selectedSegmenter == null || !selectedSegmenter.isTrained()) {
JOptionPane.showMessageDialog(null, "Please select a segmentation algoritm and train it");
return;
}
ImageLabelingModel imageLabeling = segmentationModel.imageLabelingModel();
RandomAccessibleInterval<ShortType> segmentation = selectedSegmenter.results(imageLabeling).segmentation();
ParallelUtils.runInOtherThread(() -> {
ParallelUtils.populateCachedImg(segmentation, new SwingProgressWriter(null, "Calculate Entire Segmentation"));
JOptionPane.showMessageDialog(null, "Calculation completed");
BdvFunctions.show(segmentation, "Segmentation").setDisplayRange(0, 1);
});
}
use of sc.fiji.labkit.ui.models.ImageLabelingModel in project labkit-ui by juglab.
the class LabelingComponentDemo method initModel.
private static ImageLabelingModel initModel() {
final ImagePlus imp = new ImagePlus("https://imagej.nih.gov/ij/images/FluorescentCells.jpg");
ImgPlus<?> image = VirtualStackAdapter.wrap(imp);
return new ImageLabelingModel(new DatasetInputImage(image));
}
use of sc.fiji.labkit.ui.models.ImageLabelingModel in project labkit-ui by juglab.
the class LabelingComponentDemo method main.
public static void main(String... args) {
JFrame frame = new JFrame();
frame.setSize(400, 400);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
ImageLabelingModel model = initModel();
frame.add(initLabelingComponent(frame, model));
frame.setVisible(true);
}
Aggregations