Search in sources :

Example 6 with SegmentationItem

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);
}
Also used : SegmentationItem(sc.fiji.labkit.ui.models.SegmentationItem) ArrayList(java.util.ArrayList) File(java.io.File)

Example 7 with SegmentationItem

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;
}
Also used : ExtensionPoints(sc.fiji.labkit.ui.models.ExtensionPoints) SegmentationItem(sc.fiji.labkit.ui.models.SegmentationItem) SegmenterListModel(sc.fiji.labkit.ui.models.SegmenterListModel)

Example 8 with SegmentationItem

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());
}
Also used : ColoredLabelsModel(sc.fiji.labkit.ui.models.ColoredLabelsModel) ImageLabelingModel(sc.fiji.labkit.ui.models.ImageLabelingModel) SegmentationItem(sc.fiji.labkit.ui.models.SegmentationItem) TrainClassifier(sc.fiji.labkit.ui.segmentation.TrainClassifier)

Aggregations

SegmentationItem (sc.fiji.labkit.ui.models.SegmentationItem)8 ShortType (net.imglib2.type.numeric.integer.ShortType)4 ImageLabelingModel (sc.fiji.labkit.ui.models.ImageLabelingModel)4 ValuePair (net.imglib2.util.ValuePair)3 Test (org.junit.Test)3 Context (org.scijava.Context)3 DatasetInputImage (sc.fiji.labkit.ui.inputimage.DatasetInputImage)3 DefaultSegmentationModel (sc.fiji.labkit.ui.models.DefaultSegmentationModel)3 SegmentationModel (sc.fiji.labkit.ui.models.SegmentationModel)3 ArrayList (java.util.ArrayList)2 ImgPlus (net.imagej.ImgPlus)2 UnsignedByteType (net.imglib2.type.numeric.integer.UnsignedByteType)2 Labeling (sc.fiji.labkit.ui.labeling.Labeling)2 ColoredLabelsModel (sc.fiji.labkit.ui.models.ColoredLabelsModel)2 TrainClassifier (sc.fiji.labkit.ui.segmentation.TrainClassifier)2 File (java.io.File)1 FinalInterval (net.imglib2.FinalInterval)1 AddLabelingIoAction (sc.fiji.labkit.ui.actions.AddLabelingIoAction)1 BatchSegmentAction (sc.fiji.labkit.ui.actions.BatchSegmentAction)1 BitmapImportExportAction (sc.fiji.labkit.ui.actions.BitmapImportExportAction)1