Skip to content

Commit

Permalink
add CsvRowDecoder derivation for ImagingContext, based on decoder for…
Browse files Browse the repository at this point in the history
… each component
  • Loading branch information
vreuter committed Oct 16, 2024
1 parent fdb7c66 commit 06b6c72
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/io/src/main/scala/csv/instances/InstancesForImaging.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ trait InstancesForImaging:
given CellEncoder[ImagingTimepoint] =
CellEncoder.fromSimpleShow[ImagingTimepoint]

given csvRowDecoderForImagingContext(using
decFov: CsvRowDecoder[FieldOfViewLike, String],
decTime: CsvRowDecoder[ImagingTimepoint, String],
decChannel: CsvRowDecoder[ImagingChannel, String]
): CsvRowDecoder[ImagingContext, String] = new:
override def apply(row: RowF[Some, String]): DecoderResult[ImagingContext] =
val fovNel = decFov(row)
val timeNel = decTime(row)
val channelNel = decChannel(row)
(fovNel, timeNel, channelNel).mapN(ImagingContext.apply)

given csvRowEncoderForImagingContext(using
encFov: CellEncoder[FieldOfViewLike],
envTime: CellEncoder[ImagingTimepoint],
Expand Down

0 comments on commit 06b6c72

Please sign in to comment.