diff --git a/components/bio-formats-plugins/src/loci/plugins/out/Exporter.java b/components/bio-formats-plugins/src/loci/plugins/out/Exporter.java index 2a953b3fea7..7395b38fcfd 100644 --- a/components/bio-formats-plugins/src/loci/plugins/out/Exporter.java +++ b/components/bio-formats-plugins/src/loci/plugins/out/Exporter.java @@ -505,7 +505,7 @@ else if (FormatTools.isSigned(originalType)) { String lsid = MetadataTools.createLSID("Channel", 0, c); store.setChannelID(lsid, 0, c); } - store.setChannelSamplesPerPixel(new PositiveInteger(channels), 0, 0); + store.setChannelSamplesPerPixel(new PositiveInteger(channels), 0, c); if (imp instanceof CompositeImage) { luts[c] = ((CompositeImage) imp).getChannelLut(c + 1); diff --git a/components/formats-bsd/src/loci/formats/out/DicomWriter.java b/components/formats-bsd/src/loci/formats/out/DicomWriter.java index 23c6921f81a..808f81ea87b 100644 --- a/components/formats-bsd/src/loci/formats/out/DicomWriter.java +++ b/components/formats-bsd/src/loci/formats/out/DicomWriter.java @@ -988,7 +988,7 @@ public void setId(String id) throws FormatException, IOException { opticalSequence.children.add(illuminationTypeCodes); DicomTag wavelength = new DicomTag(ILLUMINATION_WAVELENGTH, FL); - Length wave = r.getChannelEmissionWavelength(pyramid, c); + Length wave = fixUnits(r.getChannelEmissionWavelength(pyramid, c)); wavelength.value = new float[] {wave == null ? 1f : wave.value(UNITS.NM).floatValue()}; opticalSequence.children.add(wavelength); @@ -1019,7 +1019,7 @@ public void setId(String id) throws FormatException, IOException { DicomTag sliceThickness = new DicomTag(SLICE_THICKNESS, DS); DicomTag sliceSpace = new DicomTag(SLICE_SPACING, DS); - Length physicalZ = r.getPixelsPhysicalSizeZ(pyramid); + Length physicalZ = fixUnits(r.getPixelsPhysicalSizeZ(pyramid)); if (physicalZ != null) { sliceThickness.value = padString(String.valueOf(physicalZ.value(UNITS.MM))); } @@ -1032,8 +1032,8 @@ public void setId(String id) throws FormatException, IOException { pixelMeasuresSequence.children.add(sliceSpace); DicomTag pixelSpacing = new DicomTag(PIXEL_SPACING, DS); - Length physicalX = r.getPixelsPhysicalSizeX(pyramid); - Length physicalY = r.getPixelsPhysicalSizeY(pyramid); + Length physicalX = fixUnits(r.getPixelsPhysicalSizeX(pyramid)); + Length physicalY = fixUnits(r.getPixelsPhysicalSizeY(pyramid)); String px = physicalX == null ? "1" : String.valueOf(physicalX.value(UNITS.MM)); String py = physicalY == null ? "1" : String.valueOf(physicalY.value(UNITS.MM)); pixelSpacing.value = padString(px + "\\" + py); @@ -1383,6 +1383,11 @@ public void close() throws IOException { for (int res=0; res