Skip to content

Commit fd64a57

Browse files
authored
Merge branch 'master' into delete-workflow-reports
2 parents 5ad996b + d40dfbe commit fd64a57

31 files changed

+245
-59
lines changed

CHANGELOG.unreleased.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
1616
- Most sliders have been improved: Wheeling above a slider now changes its value and double-clicking its knob resets it to its default value. [#8095](https://github.com/scalableminds/webknossos/pull/8095)
1717
- It is now possible to search for unnamed segments with the full default name instead of only their id. [#8133](https://github.com/scalableminds/webknossos/pull/8133)
1818
- Increased loading speed for precomputed meshes. [#8110](https://github.com/scalableminds/webknossos/pull/8110)
19+
- Added a button to the search popover in the skeleton and segment tab to select all matching non-group results. [#8123](https://github.com/scalableminds/webknossos/pull/8123)
1920
- Unified wording in UI and code: “Magnification”/“mag” is now used in place of “Resolution“ most of the time, compare [https://docs.webknossos.org/webknossos/terminology.html](terminology document). [#8111](https://github.com/scalableminds/webknossos/pull/8111)
2021
- Added support for adding remote OME-Zarr NGFF version 0.5 datasets. [#8122](https://github.com/scalableminds/webknossos/pull/8122)
2122
- Workflow reports may be deleted. [#8156](https://github.com/scalableminds/webknossos/pull/8156)
@@ -28,6 +29,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
2829

2930
### Fixed
3031
- Fixed a bug during dataset upload in case the configured `datastore.baseFolder` is an absolute path. [#8098](https://github.com/scalableminds/webknossos/pull/8098) [#8103](https://github.com/scalableminds/webknossos/pull/8103)
32+
- Fixed bbox export menu item [#8152](https://github.com/scalableminds/webknossos/pull/8152)
3133
- When trying to save an annotation opened via a link including a sharing token, the token is automatically discarded in case it is insufficient for update actions but the users token is. [#8139](https://github.com/scalableminds/webknossos/pull/8139)
3234
- Fixed that the skeleton search did not automatically expand groups that contained the selected tree [#8129](https://github.com/scalableminds/webknossos/pull/8129)
3335
- Fixed a bug that zarr streaming version 3 returned the shape of mag (1, 1, 1) / the finest mag for all mags. [#8116](https://github.com/scalableminds/webknossos/pull/8116)

MIGRATIONS.unreleased.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ User-facing changes are documented in the [changelog](CHANGELOG.released.md).
1212

1313
- [121-worker-name.sql](conf/evolutions/121-worker-name.sql)
1414
- [122-resolution-to-mag.sql](conf/evolutions/122-resolution-to-mag.sql)
15+
- [123-more-model-categories.sql](conf/evolutions/123-more-model-categories.sql)

app/controllers/AiModelController.scala

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ object UpdateAiModelParameters {
5757
implicit val jsonFormat: OFormat[UpdateAiModelParameters] = Json.format[UpdateAiModelParameters]
5858
}
5959

60+
case class RegisterAiModelParameters(id: ObjectId, // must be a valid MongoDB ObjectId
61+
dataStoreName: String,
62+
name: String,
63+
comment: Option[String],
64+
category: Option[AiModelCategory])
65+
66+
object RegisterAiModelParameters {
67+
implicit val jsonFormat: OFormat[RegisterAiModelParameters] = Json.format[RegisterAiModelParameters]
68+
}
69+
6070
class AiModelController @Inject()(
6171
aiModelDAO: AiModelDAO,
6272
aiModelService: AiModelService,
@@ -209,6 +219,28 @@ class AiModelController @Inject()(
209219
} yield Ok(jsResult)
210220
}
211221

222+
def registerAiModel: Action[RegisterAiModelParameters] =
223+
sil.SecuredAction.async(validateJson[RegisterAiModelParameters]) { implicit request =>
224+
for {
225+
_ <- userService.assertIsSuperUser(request.identity)
226+
_ <- dataStoreDAO.findOneByName(request.body.dataStoreName) ?~> "dataStore.notFound"
227+
_ <- aiModelDAO.findOne(request.body.id).reverse ?~> "aiModel.id.taken"
228+
_ <- aiModelDAO.findOneByName(request.body.name).reverse ?~> "aiModel.name.taken"
229+
_ <- aiModelDAO.insertOne(
230+
AiModel(
231+
request.body.id,
232+
_organization = request.identity._organization,
233+
request.body.dataStoreName,
234+
request.identity._id,
235+
None,
236+
List.empty,
237+
request.body.name,
238+
request.body.comment,
239+
request.body.category
240+
))
241+
} yield Ok
242+
}
243+
212244
def deleteAiModel(aiModelId: String): Action[AnyContent] =
213245
sil.SecuredAction.async { implicit request =>
214246
for {

app/models/aimodels/AiModel.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,11 @@ class AiModelDAO @Inject()(sqlClient: SqlClient)(implicit ec: ExecutionContext)
144144
q"UPDATE webknossos.aiModels SET name = ${a.name}, comment = ${a.comment}, modified = ${a.modified} WHERE _id = ${a._id}".asUpdate)
145145
} yield ()
146146

147+
def findOneByName(name: String)(implicit ctx: DBAccessContext): Fox[AiModel] =
148+
for {
149+
accessQuery <- readAccessQuery
150+
r <- run(q"SELECT $columns FROM $existingCollectionName WHERE name = $name AND $accessQuery".as[AimodelsRow])
151+
parsed <- parseFirst(r, name)
152+
} yield parsed
153+
147154
}

app/models/aimodels/AiModelCategory.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import com.scalableminds.util.enumeration.ExtendedEnumeration
44

55
object AiModelCategory extends ExtendedEnumeration {
66
type AiModelCategory = Value
7-
val em_neurons, em_nuclei = Value
7+
val em_neurons, em_nuclei, em_synapses, em_neuron_types, em_cell_organelles = Value
88
}

app/utils/sql/SQLDAO.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ abstract class SQLDAO[C, R, X <: AbstractTable[R]] @Inject()(sqlClient: SqlClien
4747
case Some(r) =>
4848
parse(r) ?~> ("sql: could not parse database row for object" + id)
4949
case _ =>
50-
Fox.failure("sql: could not find object " + id)
50+
Fox.empty
5151
}.flatten
5252

5353
@nowarn // suppress warning about unused implicit ctx, as it is used in subclasses

app/views/mail/jobFailedUploadConvert.scala.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
<p>Here are some tips for uploading and converting datasets:
1313
<ul>
14-
<li><a href="https://docs.webknossos.org/webknossos/data_formats.html">See the document on supported files formats</a></li>
14+
<li><a href="https://docs.webknossos.org/webknossos/data/index.html">See the document on supported files formats</a></li>
1515
<li><a href="https://docs.webknossos.org/webknossos-py/index.html">Try our Python library for uploading datasets</a></li>
16-
<li><a href="https://docs.webknossos.org/webknossos/datasets.html#working-with-zarr-neuroglancer-precomputed-and-n5-datasets">Try streaming your data as Zarr, Neuroglancer, or N5 files instead of uploading</a></li>
16+
<li><a href="https://docs.webknossos.org/webknossos/data/streaming.html">Try streaming your data as Zarr, Neuroglancer, or N5 files instead of uploading</a></li>
1717
</ul>
1818
</p>
1919

app/views/mail/jobSuccessfulSegmentation.scala.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</div>
3939

4040
<p>
41-
Do you want to make corrections to the automated segmentation? Use the easy-to-use, built-in <a href="https://docs.webknossos.org/webknossos/proof_reading.html#proofreading-tool">proof-reading tools in WEBKNOSSOS</a> (requires Power plan).
41+
Do you want to make corrections to the automated segmentation? Use the easy-to-use, built-in <a href="https://docs.webknossos.org/webknossos/proofreading/tools.html">proof-reading tools in WEBKNOSSOS</a> (requires Power plan).
4242
</p>
4343
<div style="text-align: center; margin-bottom: 20px;">
4444
<img src="https://static.webknossos.org/mails/email-proofreading-preview.600.jpg"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
-- no transaction here, since ALTER TYPE ... ADD cannot run inside a transaction block
3+
4+
do $$ begin ASSERT (select schemaVersion from webknossos.releaseInformation) = 122, 'Previous schema version mismatch'; end; $$ LANGUAGE plpgsql;
5+
6+
ALTER TYPE webknossos.AI_MODEL_CATEGORY ADD VALUE 'em_synapses';
7+
ALTER TYPE webknossos.AI_MODEL_CATEGORY ADD VALUE 'em_neuron_types';
8+
ALTER TYPE webknossos.AI_MODEL_CATEGORY ADD VALUE 'em_cell_organelles';
9+
10+
UPDATE webknossos.releaseInformation SET schemaVersion = 123;
11+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
START TRANSACTION;
2+
3+
do $$ begin ASSERT (select schemaVersion from webknossos.releaseInformation) = 123, 'Previous schema version mismatch'; end; $$ LANGUAGE plpgsql;
4+
5+
-- removing enum values is not supported in postgres, see https://www.postgresql.org/docs/current/datatype-enum.html#DATATYPE-ENUM-IMPLEMENTATION-DETAILS
6+
7+
UPDATE webknossos.aiModels SET isDeleted = TRUE WHERE category IN ('em_synapses', 'em_neuron_types', 'em_cell_organelles');
8+
9+
UPDATE webknossos.releaseInformation SET schemaVersion = 122;
10+
11+
COMMIT TRANSACTION;

0 commit comments

Comments
 (0)