use of sc.fiji.labkit.ui.models.SegmentationItem in project labkit-ui by juglab.
the class LabkitProjectFrame method updateSegmenterFiles.
private static void updateSegmenterFiles(LabkitProjectModel projectModel, SegmenterListModel segmenterListModel) throws IOException {
File segmentersDirectory = new File(projectModel.getProjectDirectory(), "segmenters");
if (!segmentersDirectory.isDirectory())
Files.createDirectory(segmentersDirectory.toPath());
List<String> files = new ArrayList<>();
for (SegmentationItem segmentationItem : segmenterListModel.segmenters().get()) {
if (!segmentationItem.isTrained())
continue;
String result = saveSegmenter(segmentationItem, segmentersDirectory);
files.add(result);
}
List<String> oldFiles = projectModel.segmenterFiles();
removeObsoleteFiles(files, oldFiles);
projectModel.segmenterFiles().clear();
projectModel.segmenterFiles().addAll(files);
}
use of sc.fiji.labkit.ui.models.SegmentationItem in project labkit-ui by juglab.
the class ProjectSegmentationModel method initSegmenterListModel.
private SegmenterListModel initSegmenterListModel(List<String> segmenters) {
SegmenterListModel segmenterListModel = new SegmenterListModel(context, new ExtensionPoints());
segmenterListModel.trainingData().set(new TrainingData());
for (String filename : segmenters) {
SegmentationItem segmentationItem = segmenterListModel.addSegmenter(PixelClassificationPlugin.create());
segmentationItem.openModel(filename);
}
return segmenterListModel;
}
use of sc.fiji.labkit.ui.models.SegmentationItem in project labkit-ui by juglab.
the class SegmentationComponent 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, unmodifiableLabels, new ColoredLabelsModel(labelingModel));
MeasureConnectedComponents.addAction(extensible, labelingModel);
new ShowHelpAction(extensible);
labelingComponent.addShortcuts(extensible.getShortCuts());
}
Aggregations