use of qupath.process.gui.commands.density.DensityMapUI.DensityMapObjects in project qupath by qupath.
the class DensityMapDialog method buildAllObjectsPane.
private Pane buildAllObjectsPane(ObservableDensityMapBuilder params) {
ComboBox<DensityMapObjects> comboObjectType = new ComboBox<>();
comboObjectType.getItems().setAll(DensityMapObjects.values());
comboObjectType.getSelectionModel().select(DensityMapObjects.DETECTIONS);
params.allObjectTypes.bind(comboObjectType.getSelectionModel().selectedItemProperty());
ComboBox<PathClass> comboAllObjects = new ComboBox<>(createObservablePathClassList(DensityMapUI.ANY_CLASS));
comboAllObjects.setButtonCell(GuiTools.createCustomListCell(p -> classificationText(p)));
comboAllObjects.setCellFactory(c -> GuiTools.createCustomListCell(p -> classificationText(p)));
params.allObjectClass.bind(comboAllObjects.getSelectionModel().selectedItemProperty());
comboAllObjects.getSelectionModel().selectFirst();
ComboBox<PathClass> comboPrimary = new ComboBox<>(createObservablePathClassList(DensityMapUI.ANY_CLASS, DensityMapUI.ANY_POSITIVE_CLASS));
comboPrimary.setButtonCell(GuiTools.createCustomListCell(p -> classificationText(p)));
comboPrimary.setCellFactory(c -> GuiTools.createCustomListCell(p -> classificationText(p)));
params.densityObjectClass.bind(comboPrimary.getSelectionModel().selectedItemProperty());
comboPrimary.getSelectionModel().selectFirst();
ComboBox<DensityMapType> comboDensityType = new ComboBox<>();
comboDensityType.getItems().setAll(DensityMapType.values());
comboDensityType.getSelectionModel().select(DensityMapType.SUM);
params.densityType.bind(comboDensityType.getSelectionModel().selectedItemProperty());
var pane = createGridPane();
int row = 0;
var labelObjects = createTitleLabel("Choose all objects to include");
PaneTools.addGridRow(pane, row++, 0, null, labelObjects, labelObjects, labelObjects);
PaneTools.addGridRow(pane, row++, 0, "Select objects used to generate the density map.\n" + "Use 'All detections' to include all detection objects (including cells and tiles).\n" + "Use 'All cells' to include cell objects only.\n" + "Use 'Point annotations' to use annotated points rather than detections.", new Label("Object type"), comboObjectType, comboObjectType);
PaneTools.addGridRow(pane, row++, 0, "Select object classifications to include.\n" + "Use this to filter out detections that should not contribute to the density map at all.\n" + "For example, this can be used to selectively consider tumor cells and ignore everything else.\n" + "If used in combination with 'Secondary class' and 'Density type: Objects %', the 'Secondary class' defines the numerator and the 'Main class' defines the denominator.", new Label("Main class"), comboAllObjects, comboAllObjects);
var labelDensities = createTitleLabel("Define density map");
PaneTools.addGridRow(pane, row++, 0, null, labelDensities);
PaneTools.addGridRow(pane, row++, 0, "Calculate the density of objects containing a specified classification.\n" + "If used in combination with 'Main class' and 'Density type: Objects %', the 'Secondary class' defines the numerator and the 'Main class' defines the denominator.\n" + "For example, choose 'Main class: Tumor', 'Secondary class: Positive' and 'Density type: Objects %' to define density as the proportion of tumor cells that are positive.", new Label("Secondary class"), comboPrimary, comboPrimary);
PaneTools.addGridRow(pane, row++, 0, "Select method of normalizing densities.\n" + "Choose whether to show raw counts, or normalize densities by area or the number of objects locally.\n" + "This can be used to distinguish between the total number of objects in an area with a given classification, " + "and the proportion of objects within the area with that classification.\n" + "Gaussian weighting gives a smoother result, but it can be harder to interpret.", new Label("Density type"), comboDensityType, comboDensityType);
var sliderRadius = new Slider(0, 1000, params.radius.get());
sliderRadius.valueProperty().bindBidirectional(params.radius);
initializeSliderSnapping(sliderRadius, 50, 1, 0.1);
var tfRadius = createTextField();
boolean expandSliderLimits = true;
GuiTools.bindSliderAndTextField(sliderRadius, tfRadius, expandSliderLimits, 2);
GuiTools.installRangePrompt(sliderRadius);
PaneTools.addGridRow(pane, row++, 0, "Select smoothing radius used to calculate densities.\n" + "This is defined in calibrated pixel units (e.g. " + GeneralTools.micrometerSymbol() + " if available).", new Label("Density radius"), sliderRadius, tfRadius);
PaneTools.setToExpandGridPaneWidth(comboObjectType, comboPrimary, comboAllObjects, comboDensityType, sliderRadius);
return pane;
}
Aggregations