Skip to content

Commit

Permalink
clearer name for the channel in which a spot is detected
Browse files Browse the repository at this point in the history
  • Loading branch information
vreuter committed Oct 12, 2024
1 parent 16745ff commit 60d7288
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 25 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
* `Area` and `MeanIntensity` data types, in a new subpackage--`measurement`--of the `roi` module.
* Many new data types and typeclass instances.

## [v0.1.0] - 2024-07-10

Expand Down
2 changes: 1 addition & 1 deletion modules/io/src/main/scala/csv/Columns.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ object ColumnNames:
val TimepointColumnName = ColumnName[ImagingTimepoint]("timepoint")

/** Key for field of imaging channel */
val ChannelColumnName = ColumnName[ImagingChannel]("roiChannel")
val SpotChannelColumnName = ColumnName[ImagingChannel]("spotChannel")

/** Key for z-coordinate of spot centroid */
def zCenterColumnName[C] = ColumnName[ZCoordinate[C]]("zc")
Expand Down
22 changes: 2 additions & 20 deletions modules/io/src/main/scala/csv/instances/InstancesForImaging.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,31 +56,13 @@ trait InstancesForImaging:
given CellEncoder[ImagingTimepoint] =
CellEncoder.fromSimpleShow[ImagingTimepoint]

given defaultCsvRowDecoderForImagingContext(using
CellDecoder[FieldOfViewLike],
CellDecoder[ImagingTimepoint],
CellDecoder[ImagingChannel]
): CsvRowDecoder[ImagingContext, String] = new:
override def apply(row: RowF[Some, String]): DecoderResult[ImagingContext] =
val fovNel = ColumnNames.FieldOfViewColumnName.from(row)
val timeNel = ColumnNames.TimepointColumnName.from(row)
val channelNel = ColumnNames.ChannelColumnName.from(row)
(fovNel, timeNel, channelNel)
.mapN(ImagingContext.apply)
.toEither
.leftMap { messages =>
DecoderError(
s"Cannot decode imaging context because of ${messages.length} error(s): ${messages.mkString_("; ")}"
)
}

given csvRowEncoderForImagingContext(using
encFov: CellEncoder[FieldOfViewLike],
envTime: CellEncoder[ImagingTimepoint],
encChannel: CellEncoder[ImagingChannel]
encChannel: CsvRowEncoder[ImagingChannel, String]
): CsvRowEncoder[ImagingContext, String] = new:
override def apply(elem: ImagingContext): RowF[Some, String] =
val fovRow = ColumnNames.FieldOfViewColumnName.write(elem.fieldOfView)
val timeRow = ColumnNames.TimepointColumnName.write(elem.timepoint)
val channelRow = ColumnNames.ChannelColumnName.write(elem.channel)
val channelRow = encChannel(elem.channel)
fovRow |+| timeRow |+| channelRow
4 changes: 2 additions & 2 deletions modules/io/src/main/scala/csv/instances/InstancesForRoi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ trait InstancesForRoi:
def getCsvRowDecoderForDetectedSpot[C](
fovCol: ColumnNameLike[FieldOfViewLike] = FieldOfViewColumnName,
timeCol: ColumnNameLike[ImagingTimepoint] = TimepointColumnName,
channelCol: ColumnNameLike[ImagingChannel] = ChannelColumnName,
channelCol: ColumnNameLike[ImagingChannel] = SpotChannelColumnName,
zCol: ColumnNameLike[ZCoordinate[C]] = zCenterColumnName[C],
yCol: ColumnNameLike[YCoordinate[C]] = yCenterColumnName[C],
xCol: ColumnNameLike[XCoordinate[C]] = xCenterColumnName[C],
Expand Down Expand Up @@ -136,7 +136,7 @@ trait InstancesForRoi:
def getCsvRowEncoderForDetectedSpot[C](
fovCol: ColumnNameLike[FieldOfViewLike] = FieldOfViewColumnName,
timeCol: ColumnNameLike[ImagingTimepoint] = TimepointColumnName,
channelCol: ColumnNameLike[ImagingChannel] = ChannelColumnName,
channelCol: ColumnNameLike[ImagingChannel] = SpotChannelColumnName,
zCol: ColumnNameLike[ZCoordinate[C]] = zCenterColumnName[C],
yCol: ColumnNameLike[YCoordinate[C]] = yCenterColumnName[C],
xCol: ColumnNameLike[XCoordinate[C]] = xCenterColumnName[C],
Expand Down
4 changes: 2 additions & 2 deletions modules/zarr/src/main/scala/OmeZarrDimension.scala
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ object OmeZarr:
.one(s"Expected 5 dimensions but got ${indexedDims.length}")
.asLeft
else
val tNel = getUniqueIndexFor("time")(
val tNel = getUniqueIndexFor(timeName)(
_.isInstanceOf[TimepointDimension]
)(indexedDims).toValidatedNel
val cNel = getUniqueIndexFor("channel")(
val cNel = getUniqueIndexFor(channelName)(
_.isInstanceOf[ChannelDimension]
)(indexedDims).toValidatedNel
val zNel = getUniqueIndexFor("z")(_.isInstanceOf[ZDimension])(
Expand Down

0 comments on commit 60d7288

Please sign in to comment.