ENH: Write Image color table, axis flip, and physical scale bar#1671
Open
imikejackson wants to merge 23 commits into
Open
ENH: Write Image color table, axis flip, and physical scale bar#1671imikejackson wants to merge 23 commits into
imikejackson wants to merge 23 commits into
Conversation
…uartzSoftware#1617) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…lueQuartzSoftware#1617) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rtzSoftware#1617) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…1617) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…oftware#1617) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…put (BlueQuartzSoftware#1617) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ueQuartzSoftware#1617) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…re#1617) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ip tests (BlueQuartzSoftware#1617) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tware#1617) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Rename k_FlipMode_Key value "flip_mode" -> "flip_mode_index" so the ChoicesParameter key satisfies the FilterValidation parameter-key convention (ChoicesParameter keys must end with "_index"), fixing the failing "nx::core::FilterValidation::Filter Parameter Keys" test. * Update the parametersVersion history comment accordingly. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
* Guard NormalizeValue against non-finite inputs and signed-integer overflow for wide integer types; constant and degenerate ranges map deterministically to the first control color * Guard NormalizeBinPoints against single-control-color presets and reject presets with fewer than 2 control colors in WriteImage and CreateColorMap, preventing an out-of-bounds read * Add IImageIO::supportedWriteComponentCounts and validate component count during non-color preflight so unsupported counts fail before execution instead of writing non-conforming files * Declare EXTRASAMPLES for 4-component TIFF output * Validate the selected color preset during preflight Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
* Add 3D multi-slice color-table roundtrips for XY, XZ, and YZ planes with independent index derivation * Span negative values in signed-type color roundtrips * Cover FlipAboutYAxis with 3-component pixels and odd-height FlipAboutXAxis * Exercise the uint8 mask branch alongside bool * Extend the format/type preflight matrix (.bmp, .jpg, float64) and add component-count validation cases with error-code assertions Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
* Exposes the header via the simplnx target BUILD_INTERFACE so any plugin can draw with it; SimplnxCore needs it for the Write Image scale bar (BlueQuartzSoftware#786) * WritePoleFigureFilter keeps its CANVAS_ITY_IMPLEMENTATION define; each shared library compiles its own copy of the single-header implementation Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
* fonts::Base64Decode and the embedded Lato Regular TTF are needed by the core ScaleBarRenderer for the Write Image scale bar (BlueQuartzSoftware#786) * LatoBold and FiraSansRegular stay in OrientationAnalysis (only used by WritePoleFigureFilter) Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
* ComputeNiceBarLength picks the largest 1/2/5 x 10^n length that fits 25% of the physical image width * FormatLengthLabel renders metric units with SI engineering prefixes (0.0001 m -> "100 µm"); non-metric units label as-is; Unspecified omits the suffix * ComputeBandHeight sizes the padded band (8% of height, min 24 px) * Band rendering lands in a follow-up commit Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
* White band with a centered black bar at integer pixel coordinates and the length label in embedded Lato Regular above it * Band-only rendering: image pixels never pass through the canvas so the written image region stays byte-for-byte identical Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
* New optional 'Add Physical Scale Bar' bool (add_scale_bar); parameters version bumped to 5 * Preflight requires uint8 (1/3/4 components) or color-table mode and positive finite horizontal spacing; reports the padded output size Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
* Band renders once per run and is appended below each slice after the flip, so the bar is always upright at the bottom * Slice pixels convert to RGB (grayscale replicated, alpha dropped); image region stays byte-for-byte identical to bar-off output * Bar-off path is unchanged Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
* Align docs heading with sibling "(Optional)" sections * Add XZ-plane scale-bar read-back test locking per-plane dims and horizontal-spacing selection * Document ConvertUInt8ToRgb's uint8 precondition; hoist loop-invariant stride locals out of writeSlice; minor const/reuse tidies in preflight Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
* Bar sits one margin from the band's left edge, vertically centered; the length label renders inline to the right of the bar * Degenerate narrow images clamp the bar start so it stays on-canvas * Renderer and Write Image test probes updated to the new layout; filter docs describe the left-justified inline arrangement Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
* Swaps all 12 ITKImageWriterFilter instances across 7 example pipelines to WriteImageFilter; every instance writes uint8 RGB PNGs, which Write Image supports natively without the ITK dependency * Args carry the full parameters_version 5 key set with defaults so the pipelines load without missing-parameter warnings Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
imikejackson
force-pushed
the
topic/write_images_color_table
branch
from
July 16, 2026 18:10
df74cff to
01892d7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the Write Image filter with color-table generation, broader type support, format-aware validation, an output flip, and a physical scale bar. Closes #1617. Closes #786.
50 µm). The bar length is chosen automatically (largest 1/2/5×10ⁿ value ≤ 25% of the physical image width, from the Image Geometry's spacing) and the label units come from the geometry's length unit, rescaled to a readable SI prefix. The band is appended — image pixels are never covered — and the written file becomes 8-bit RGB. Requires uint8 input (1/3/4 components) or Create Color Table; validated during preflight along with the geometry spacing. Flip composes correctly: the bar stays upright at the bottom.Internally, the control-point interpolation and normalization were extracted into shared
ColorTableUtilitieshelpers (with a min == max divide-by-zero guard), and Create Color Map was refactored onto them so both filters use one implementation. For the scale bar, the vendoredcanvas_ity2D canvas library and the Lato Regular embedded font moved from OrientationAnalysis to the core simplnx library (build-tree include only, nothing new installed), and the measurement/rendering logic lives in a new unit-testedScaleBarRenderercore utility.Test Plan