Skip to content

Commit

Permalink
feat(loaders): Set default PhysicalSizeUnit to µm (#728)
Browse files Browse the repository at this point in the history
  • Loading branch information
manzt authored Nov 15, 2023
1 parent 51aca92 commit a1a8007
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-plants-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@vivjs/loaders': patch
---

feat: Set default PhysicalSizeUnit to µm
8 changes: 4 additions & 4 deletions packages/loaders/src/omexml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ const PixelsSchema = z
PhysicalSizeY: z.coerce.number().optional(),
PhysicalSizeZ: z.coerce.number().optional(),
SignificantBits: z.coerce.number().optional(),
PhysicalSizeXUnit: UnitsLengthSchema.optional(),
PhysicalSizeYUnit: UnitsLengthSchema.optional(),
PhysicalSizeZUnit: UnitsLengthSchema.optional(),
PhysicalSizeXUnit: UnitsLengthSchema.optional().default('µm'),
PhysicalSizeYUnit: UnitsLengthSchema.optional().default('µm'),
PhysicalSizeZUnit: UnitsLengthSchema.optional().default('µm'),
BigEndian: z
.string()
.transform(v => v.toLowerCase() === 'true')
Expand Down Expand Up @@ -184,7 +184,7 @@ export function fromString(str: string) {
.map(name => {
const size = img.Pixels[`PhysicalSize${name}` as const];
const unit = img.Pixels[`PhysicalSize${name}Unit` as const];
return size && unit ? `${size} ${unit}` : '-';
return size ? `${size} ${unit}` : '-';
})
.join(' x ');

Expand Down

0 comments on commit a1a8007

Please sign in to comment.