Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ trait StaticLayer extends DataLayer {

def numChannels: Int = if (elementClass == ElementClass.uint24) 3 else 1

def attachments: Option[DataLayerAttachments]

def withMergedAndResolvedAttachments(dataSourcePath: UPath, attachments: DataLayerAttachments): StaticLayer =
this match {
case l: StaticSegmentationLayer =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ case class DataLayerAttachments(
connectomes = connectomes.map(_.relativizedIn(dataSourcePath)),
cumsum = cumsum.map(_.relativizedIn(dataSourcePath))
)

lazy val containsDuplicateNames: Boolean =
meshes.distinctBy(_.name).length != meshes.length ||
agglomerates.distinctBy(_.name).length != agglomerates.length ||
connectomes.distinctBy(_.name).length != connectomes.length
}

object DataLayerAttachments {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ trait DataSourceValidation {
check(
dataSource.dataLayers.map(_.name).forall(!_.startsWith(".")),
"Layer names must not start with dot."
),
check(
dataSource.dataLayers.flatMap(_.attachments).forall(!_.containsDuplicateNames),
"Layer attachments must have unique names in their respective category."
)
).flatten

Expand Down
Loading