Skip to content

Commit

Permalink
[api]: Fix "Missing bounds Image attribute"
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagohm committed Apr 1, 2024
1 parent d886ba7 commit 5558cfb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nebulosa-xisf/src/main/kotlin/nebulosa/xisf/XisfFormat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ data object XisfFormat : ImageFormat {
val bitpix = hdu.header.bitpix
val sampleFormat = SampleFormat.from(bitpix)
val imageSize = hdu.width * hdu.height * hdu.numberOfChannels * sampleFormat.byteLength
val extra = if (bitpix.code < 0) " bounds=\"0:1\"" else ""

IMAGE_START_TAG
.format(
hdu.width, hdu.height, hdu.numberOfChannels,
sampleFormat.code, colorSpace.code, imageType.code, initialHeaderSize, imageSize
sampleFormat.code, colorSpace.code, imageType.code,
initialHeaderSize, imageSize, extra
).also(buffer::writeUtf8)

for ((name, key) in AstronomicalImageProperties) {
Expand Down Expand Up @@ -196,7 +198,7 @@ data object XisfFormat : ImageFormat {
"""<xisf version="1.0" xmlns="http://www.pixinsight.com/xisf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.pixinsight.com/xisf http://pixinsight.com/xisf/xisf-1.0.xsd">"""
private const val XISF_END_TAG = "</xisf>"
private const val IMAGE_START_TAG =
"""<Image geometry="%d:%d:%d" sampleFormat="%s" colorSpace="%s" imageType="%s" pixelStorage="Planar" location="attachment:%d:%d">"""
"""<Image geometry="%d:%d:%d" sampleFormat="%s" colorSpace="%s" imageType="%s" pixelStorage="Planar" location="attachment:%d:%d"%s>"""
private const val IMAGE_END_TAG = "</Image>"
private const val STRING_PROPERTY_TAG = """<Property id="%s" type="String">%s</Property>"""
private const val NON_STRING_PROPERTY_TAG = """<Property id="%s" type="%s" value="%s" />"""
Expand Down

0 comments on commit 5558cfb

Please sign in to comment.