Skip to content

Commit 6967464

Browse files
committed
Update README with minor fixes
1 parent b13e706 commit 6967464

File tree

4 files changed

+44
-17
lines changed

4 files changed

+44
-17
lines changed

README.md

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ To update the `qupath-extension-sam`, follow the following instructions.
2424

2525
1. Open extensions directory from `Extensions` > `Installed extensions` > `Open extensions directory`
2626
![](https://github.com/ksugar/qupath-extension-sam/releases/download/assets/open-extensions-directory.png)
27-
2. Replace `qupath-extension-sam-x.y.z.jar` with [the latest version of the extension file](https://github.com/ksugar/qupath-extension-sam/releases/download/v0.3.0/qupath-extension-sam-0.3.0.jar).
27+
2. Replace `qupath-extension-sam-x.y.z.jar` with [the latest version of the extension file](https://github.com/ksugar/qupath-extension-sam/releases/download/v0.4.0/qupath-extension-sam-0.4.0.jar).
2828
3. Restart QuPath application.
2929

30-
Please note that you need to also update the [samapi](https://github.com/ksugar/samapi/tree/v0.3.0) server.
30+
Please note that you need to also update the [samapi](https://github.com/ksugar/samapi/tree/v0.4.0) server.
3131
To keep updated with the latest samapi server, follow the instructions [here](https://github.com/ksugar/samapi#update).
3232

3333
## Usage
@@ -36,18 +36,20 @@ To keep updated with the latest samapi server, follow the instructions [here](ht
3636

3737
#### Rectangle (BBox) prompt
3838

39-
1. Select `Extensions` > `SAM` > `SAM prompt` from the menu bar.
40-
2. Select a rectangle tool by clicking the icon.
41-
3. Add rectangles.
42-
4. Select rectangles to process. (`Alt` + `Ctrl` + `A`: Select all annotation objects `Ctrl` or `` + left click: Select multiple objects)
43-
5. Press the `Run for selected` button.
44-
6. If you activate `Live mode`, SAM predicts a mask every time you add a rectangle.
39+
1. Select `Extensions` > `SAM` from the menu bar.
40+
2. Select the `Prompt` tab in the `Segment Anyghing Model` dialog.
41+
3. Select a rectangle tool by clicking the icon.
42+
4. Add rectangles.
43+
5. Select rectangles to process. (`Alt` + `Ctrl` + `A`: Select all annotation objects `Ctrl` or `` + left click: Select multiple objects)
44+
6. Press the `Run for selected` button.
45+
7. If you activate `Live mode`, SAM predicts a mask every time you add a rectangle.
4546

4647
<img src="https://github.com/ksugar/samapi/releases/download/assets/qupath-sam-rectangle-prompt.gif" width="768">
4748

4849
#### Point prompt
4950

50-
1. Select `Extensions` > `SAM` > `SAM prompt` from the menu bar.
51+
1. Select `Extensions` > `SAM` from the menu bar.
52+
2. Select the `Prompt` tab in the `Segment Anyghing Model` dialog.
5153
2. Select a point tool by clicking the icon.
5254
3. Add foreground points.
5355
4. (Optional) add background points.
@@ -61,6 +63,8 @@ To keep updated with the latest samapi server, follow the instructions [here](ht
6163
| key | value |
6264
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
6365
| Server | URL of the server. |
66+
| SAM type | One of `vit_h (huge)`, `vit_l (large)`, `vit_b (base)`, or `vit_t (mobile)`. |
67+
| SAM weights | The SAM weights to use. The options are automatically fetched from the server. |
6468
| Output type | If `Single Mask` is selected, the model will return single masks per prompt. If `Multi-mask` is selected, the model will return three masks per prompt. `Multi-mask (all)` keeps all three masks. One of the three masks is kept if the option `Multi-mask (largest)`, `Multi-mask (smallest)`, or `Multi-mask (best quality)` is selected. |
6569
| Display names | Display the annotation names in the viewer. (this is a global preference) |
6670
| Assign random colors | If checked and no path class is set in `Auto set` setting, assign random colors to new (unclassified) objects created by SAM. |
@@ -70,14 +74,18 @@ To keep updated with the latest samapi server, follow the instructions [here](ht
7074

7175
### SamAutomaticMaskGenerator
7276

73-
Select `Extensions` > `SAM` > `SAM auto mask` from the menu bar.
77+
1. Select `Extensions` > `SAM` from the menu bar.
78+
2. Select the `Auto mask` tab in the `Segment Anyghing Model` dialog.
79+
3. Set parameters.
80+
4. Press the `Run` button.
7481

7582
#### Parameters
7683

7784
| key | value |
7885
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7986
| Server | URL of the server. |
80-
| SAM model | One of `vit_h (huge)`, `vit_l (large)`, `vit_b (base)`, or `vit_t (mobile)`. |
87+
| SAM type | One of `vit_h (huge)`, `vit_l (large)`, `vit_b (base)`, or `vit_t (mobile)`. |
88+
| SAM weights | The SAM weights to use. The options are automatically fetched from the server. |
8189
| Assign random colors | If checked and no path class is set in `Auto set` setting, assign random colors to new (unclassified) objects created by SAM. |
8290
| Assign names | If checked, assign names to identify new objects as created by SAM, including quality scores. |
8391
| Keep prompts | If checked, keep the foreground prompts after detection. If not checked, these are deleted. |
@@ -95,6 +103,22 @@ Select `Extensions` > `SAM` > `SAM auto mask` from the menu bar.
95103
| min_mask_region_area | If >0, postprocessing will be applied to remove disconnected regions and holes in masks with area smaller than min_mask_region_area. Requires opencv. |
96104
| output_type | If 'Single Mask' is selected, the model will return single masks per prompt. If 'Multi-mask' is selected, the model will return three masks per prompt. 'Multi-mask (all)' keeps all three masks. One of the three masks is kept if the option 'Multi-mask (largest)', 'Multi-mask (smallest)', or 'Multi-mask (best quality)' is selected. |
97105
| include_image_edge | If True, include a crop area at the edge of the original image. |
106+
### Register SAM weights from URL
107+
108+
1. Select `Extensions` > `SAM` from the menu bar.
109+
2. Press the `Register` button in the `Segment Anyghing Model` dialog.
110+
111+
<img src="https://github.com/ksugar/qupath-extension-sam/releases/download/assets/qupath-sam-register-weights-from-url.png" width="768">
112+
113+
The weights file is downloaded from the URL and registered on the server. After the registration, you can select the weights from the `SAM weights` dropdown menu.
114+
115+
#### Parameters
116+
117+
| key | value |
118+
| -------- | ----------------------------------------------------------------------------- |
119+
| SAM type | One of `vit_h (huge)`, `vit_l (large)`, `vit_b (base)`, or `vit_t (mobile)`. |
120+
| Name | The SAM weights name to register. It needs to be unique in the same SAM type. |
121+
| URL | The URL to the SAM weights file. |
98122

99123
### Tips
100124

@@ -104,6 +128,9 @@ If you select a class in `Auto set` in the Annotations tab, it is used for a new
104128

105129
## Updates
106130

131+
### v0.4.0
132+
- Support for registering SAM weights from URL. [ksugar/qupath-extension-sam#8](https://github.com/ksugar/qupath-extension-sam/issues/8) [ksugar/samapi#11](https://github.com/ksugar/samapi/pull/11) by [@constantinpape](https://github.com/constantinpape)
133+
107134
### v0.3.0
108135

109136
- Support for both point and rectangle foreground prompts by [@petebankhead](https://github.com/petebankhead)

src/main/java/org/elephant/sam/commands/SAMMainCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ public void runPrompt() {
538538
List<PathObject> backgroundObjects = getBackgroundObjects(selectedObjects);
539539
submitDetectionTask(foregroundObjects, backgroundObjects);
540540
} else {
541-
updateInfoText("No foreground objects to use for detection");
541+
updateInfoText("No foreground objects to use");
542542
}
543543
}
544544

src/main/java/org/elephant/sam/ui/SAMMainPane.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private void addModelPrompt(int row) {
166166
command.submitFetchWeightsTask(newValue);
167167
});
168168
combo.setMaxWidth(Double.MAX_VALUE);
169-
Tooltip tooltip = new Tooltip("The SAM model to use for detection.\n" +
169+
Tooltip tooltip = new Tooltip("The SAM model to use.\n" +
170170
"These differ in size and speed (and maybe accuracy)");
171171
combo.setTooltip(tooltip);
172172
GridPane.setFillWidth(combo, true);
@@ -191,11 +191,11 @@ public void onChanged(Change<? extends SAMWeights> c) {
191191
});
192192
command.getSelectedWeightsProperty().bind(combo.getSelectionModel().selectedItemProperty());
193193
combo.setMaxWidth(Double.MAX_VALUE);
194-
Tooltip tooltip = new Tooltip("The SAM weight to use for detection.");
194+
Tooltip tooltip = new Tooltip("The SAM weights to use.");
195195
combo.setTooltip(tooltip);
196196
GridPane.setFillWidth(combo, true);
197197

198-
Label label = new Label("SAM weight");
198+
Label label = new Label("SAM weights");
199199
label.setLabelFor(combo);
200200
label.setTooltip(tooltip);
201201
add(label, 0, row);

src/main/java/org/elephant/sam/ui/SAMRegisterWeightsDialog.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public SAMRegisterWeightsDialog(final SAMType defaultType) {
5555
comboSAMType.getSelectionModel().select(samTypeProperty.get());
5656
samTypeProperty.bind(comboSAMType.getSelectionModel().selectedItemProperty());
5757
comboSAMType.setMaxWidth(Double.MAX_VALUE);
58-
comboSAMType.setTooltip(new Tooltip("The SAM model to use for detection."));
58+
comboSAMType.setTooltip(new Tooltip("The SAM type to register."));
5959
GridPane.setFillWidth(comboSAMType, true);
6060

6161
labelName = new Label("Name: ");
@@ -64,7 +64,7 @@ public SAMRegisterWeightsDialog(final SAMType defaultType) {
6464
textFieldName.setMaxWidth(Double.MAX_VALUE);
6565
textFieldName.setPrefColumnCount(32);
6666
textFieldName.setTooltip(
67-
new Tooltip("The SAM model name to register. It needs to be unique in the same SAM type."));
67+
new Tooltip("The SAM weights name to register. It needs to be unique in the same SAM type."));
6868
GridPane.setHgrow(textFieldName, Priority.ALWAYS);
6969
GridPane.setFillWidth(textFieldName, true);
7070

0 commit comments

Comments
 (0)