|
20 | 20 | // Specify the model name (cyto, nuclei, cyto2, ... or a path to your custom model as a string)
|
21 | 21 | // Other models for Cellpose https://cellpose.readthedocs.io/en/latest/models.html
|
22 | 22 | // And for Omnipose: https://omnipose.readthedocs.io/models.html
|
23 |
| -def pathModel = 'cyto2' |
| 23 | +def pathModel = 'cyto3' |
24 | 24 | def cellpose = Cellpose2D.builder( pathModel )
|
25 | 25 | .pixelSize( 0.5 ) // Resolution for detection in um
|
26 | 26 | .channels( 'DAPI' ) // Select detection channel(s)
|
27 | 27 | // .tempDirectory( new File( '/tmp' ) ) // Temporary directory to export images to. defaults to 'cellpose-temp' inside the QuPath Project
|
28 |
| -// .preprocess( ImageOps.Filters.median(1) ) // List of preprocessing ImageOps to run on the images before exporting them |
29 |
| -// .normalizePercentilesGlobal(0.1, 99.8, 10) // Convenience global percentile normalization. arguments are percentileMin, percentileMax, dowsample. |
30 |
| -// .tileSize(1024) // If your GPU can take it, make larger tiles to process fewer of them. Useful for Omnipose |
31 |
| -// .cellposeChannels(1,2) // Overwrites the logic of this plugin with these two values. These will be sent directly to --chan and --chan2 |
32 |
| -// .cellprobThreshold(0.0) // Threshold for the mask detection, defaults to 0.0 |
33 |
| -// .flowThreshold(0.4) // Threshold for the flows, defaults to 0.4 |
34 |
| -// .diameter(15) // Median object diameter. Set to 0.0 for the `bact_omni` model or for automatic computation |
| 28 | +// .preprocess( ImageOps.Filters.median( 1 ) ) // List of preprocessing ImageOps to run on the images before exporting them |
| 29 | +// .normalizePercentilesGlobal( 0.1, 99.8, 10 ) // Convenience global percentile normalization. arguments are percentileMin, percentileMax, dowsample. |
| 30 | +// .tileSize( 1024 ) // If your GPU can take it, make larger tiles to process fewer of them. Useful for Omnipose |
| 31 | +// .cellposeChannels( 1,2 ) // Overwrites the logic of this plugin with these two values. These will be sent directly to --chan and --chan2 |
| 32 | +// .cellprobThreshold( 0.0 ) // Threshold for the mask detection, defaults to 0.0 |
| 33 | +// .flowThreshold( 0.4 ) // Threshold for the flows, defaults to 0.4 |
| 34 | +// .diameter( 15 ) // Median object diameter. Set to 0.0 for the `bact_omni` model or for automatic computation |
35 | 35 | // .useOmnipose() // Use omnipose instead
|
36 |
| -// .addParameter("cluster") // Any parameter from cellpose or omnipose not available in the builder. |
37 |
| -// .addParameter("save_flows") // Any parameter from cellpose or omnipose not available in the builder. |
38 |
| -// .addParameter("anisotropy", "3") // Any parameter from cellpose or omnipose not available in the builder. |
39 |
| -// .cellExpansion(5.0) // Approximate cells based upon nucleus expansion |
40 |
| -// .cellConstrainScale(1.5) // Constrain cell expansion using nucleus size |
41 |
| -// .classify("My Detections") // PathClass to give newly created objects |
| 36 | +// .addParameter( "cluster" ) // Any parameter from cellpose or omnipose not available in the builder. |
| 37 | +// .addParameter( "save_flows" ) // Any parameter from cellpose or omnipose not available in the builder. |
| 38 | +// .addParameter( "anisotropy", "3" ) // Any parameter from cellpose or omnipose not available in the builder. |
| 39 | +// .cellExpansion( 5.0 ) // Approximate cells based upon nucleus expansion |
| 40 | +// .cellConstrainScale( 1.5 ) // Constrain cell expansion using nucleus size |
| 41 | +// .classify( "My Detections" ) // PathClass to give newly created objects |
42 | 42 | // .measureShape() // Add shape measurements
|
43 | 43 | // .measureIntensity() // Add cell measurements (in all compartments)
|
44 | 44 | // .createAnnotations() // Make annotations instead of detections. This ignores cellExpansion
|
45 |
| -// .simplify(0) // Simplification 1.6 by default, set to 0 to get the cellpose masks as precisely as possible |
| 45 | +// .simplify( 0 ) // Simplification 1.6 by default, set to 0 to get the cellpose masks as precisely as possible |
46 | 46 | .build()
|
47 | 47 |
|
48 | 48 | // Run detection for the selected objects
|
49 | 49 | def imageData = getCurrentImageData()
|
50 | 50 | def pathObjects = getSelectedObjects() // To process only selected annotations, useful while testing
|
51 | 51 | // def pathObjects = getAnnotationObjects() // To process all annotations. For working in batch mode
|
52 | 52 | if (pathObjects.isEmpty()) {
|
53 |
| - Dialogs.showErrorMessage("Cellpose", "Please select a parent object!") |
| 53 | + Dialogs.showErrorMessage( "Cellpose", "Please select a parent object!" ) |
54 | 54 | return
|
55 | 55 | }
|
56 | 56 |
|
57 |
| -cellpose.detectObjects(imageData, pathObjects) |
| 57 | +cellpose.detectObjects( imageData, pathObjects ) |
58 | 58 |
|
59 | 59 | // You could do some post-processing here, e.g. to remove objects that are too small, but it is usually better to
|
60 | 60 | // do this in a separate script so you can see the results before deleting anything.
|
|
0 commit comments