BUG: C19: Geometry coordinates and length units in 8 filters
メンテナーはふだん 6 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with the eight checklist entries and the linked code locations, then read the relevant filter algorithms and existing tests. Reproduce each finding with the stated small input and an independent expected value; follow the issue’s unit and cell-center rules for fixes. Done means each confirmed finding has a failing test and a corrected result, with related tests and exemplars updated.
索引モデルが issue の本文から書いたものです。
説明
Summary
Some filters set the wrong length unit on a geometry, or compute positions half a cell (or half a step) away from the correct position. Readers create an Image Geometry without a unit, so the geometry gets the Micrometer default. Other filters compute coordinates themselves and use the cell minimum corner where the cell center is meant. The output is wrong and the filter gives no error.
As of develop 419f9db35 (2026-10-21) this class has 8 open findings in 8 filters: 0 CRASH, 8 WRONG_DATA, 0 MINOR. An automated code-reading sweep found them on develop 4a7b71e5f (2026-10-08). Each finding was re-checked by reading the code on develop 419f9db35. Each finding is a candidate: nobody has run it yet.
Mechanism
This class has two sub-patterns.
1. The length unit is not set from the file or the parameter. CreateImageGeometryAction has a default unit argument. A reader that omits the argument compiles, and the new Image Geometry gets Micrometer:
CreateImageGeometryAction.hpp#L31-L32
CreateImageGeometryAction(const DataPath& path, const DimensionType& dims, const OriginType& origin, const SpacingType& spacing, const std::string& cellAttributeMatrixName,
IGeometry::LengthUnit units = IGeometry::LengthUnit::Micrometer);
A second form of this sub-pattern is a raw cast of the Length Unit choice index to the enum, for example ReadBinaryCTNorthstar.cpp#L80:
geom.setUnits(static_cast<IGeometry::LengthUnit>(inputValues->LengthUnit));
The choice list comes from IGeometry::GetAllLengthUnitStrings(). It puts Unspecified at index 27 and Unknown at index 28. In the enum, Unspecified = 100U and Unknown = 101U. The cast is correct for indices 0-26 only.
2. Half-cell or half-step coordinate offset. The Image Geometry origin is the minimum corner of cell 0. The center of cell i is origin + (i + 0.5) * spacing. ImageGeom::getCoordsf already uses this rule (ImageGeom.cpp#L323-L330). Some filters compute positions themselves and use the minimum corner instead, for example FlyingEdges.hpp#L1287-L1289:
float32 xPos = zeroPos[0] + i * spacing[0];
float32 yPos = zeroPos[1] + j * spacing[1];
float32 zPos = zeroPos[2] + k * spacing[2];
The output geometry, surface or file is then shifted by half a cell (or half a sample step). No filter of this class is fixed yet.
Rule
Decision needed: no rule for this class is decided yet. Options:
- Units, option A: Remove the default unit argument from
CreateImageGeometryActionso that every caller must pass a unit. This makes the compiler find every reader that omits it. - Units, option B: Change the default to
IGeometry::LengthUnit::Unspecified, and pass the real unit in every reader that knows it. - Choice index to enum: Map every Length Unit choice index to
IGeometry::LengthUnitthrough one shared lookup (for example a function next toGetAllLengthUnitStrings()). Do not cast the index directly. - Coordinates: Compute cell positions through the
ImageGeomhelpers (getCoordsf/getCoordsfor cell centers, origin for the minimum bound). Where a filter samples a different grid (for example a pole-figure image), usemin + (i + 0.5) * stepfor the center of samplei, and document the convention.
How to fix
- Decide the unit rule above. Then pass the unit at each
CreateImageGeometryActioncall in the checklist. For NIfTI, parsexyzt_unitsand useUnspecifiedwhen the unit is not known. For NRRD inReadImageFilter, pass the selected Length Unit. - Add one shared choice-index-to-
LengthUnitlookup. Replace the raw cast inReadBinaryCTNorthstar.cpp. The same raw cast also exists inReadImageFilter.cpp(line 387),ImportFijiMontageFilter.cpp(line 189),CreateGeometry.cpp(line 85) andReadBinaryCTNorthstarFilter.cpp(lines 515 and 524). These lines are not separate findings in this list (not confirmed whether another issue tracks them); fix them with the same lookup. Find all withgit grep -n "static_cast<IGeometry::LengthUnit>". Do not change the HDF5 readers (ImageGeomIO.cppand the others): they cast a stored enum value, not a choice index. - For each half-cell finding, replace the local coordinate formula with the cell-center rule. Change the code, the test expectations and the exemplars together. Use an independent oracle for the new expected values; do not copy the new output into the test.
- These fixes do not need new error codes. If you add a preflight warning (for example an unknown NIfTI unit), use the error-code range of that filter. Codes are more negative than -10000, and each filter uses one range of 100 codes. Check uniqueness with
git grep -nE -- "-NNNN([^0-9]|$)"on develop and on open PR refs.
How to test
- Write the failing test first.
- Units: Read a small test file whose unit is known (for example a NIfTI file with
xyzt_units= millimeter, a.vgifile withunit = mm, a.nrrdfile with Length Unit =Millimeter). Check thatImageGeom::getUnits()returnsIGeometry::LengthUnit::Millimeter. For the choice-index finding, set Length Unit toUnspecifiedand toUnknown, and check that the result isLengthUnit::UnspecifiedandLengthUnit::Unknown. - Coordinates: Use a small Image Geometry with origin (0,0,0) and spacing (1,1,1). Compute the expected positions by hand from the cell-center rule. Examples: a Cell Data step between cells 0 and 1 gives a FlyingEdges3D surface at x = 1.0; dims (2,1,1) gives VTK rectilinear X coordinates 0, 1, 2; an edge of length 1 with three samples gives cumulative distances 1/6, 1/2, 5/6. For ComputeGBCDPoleFigure, use Output Image Dimension = 3 and check the pixel center positions against
-1 + (l + 0.5) * (2/3). Test both the Direct and the Scanline algorithm through the existing algorithm-selection test scope.
Conventions
- Make one PR for the whole class. Make one commit for each filter.
- Start each commit message with
BUG:. Add aSigned-off-byline. Do not add AI attribution. - Start every fix with a unit test that fails on develop. If you cannot reproduce a finding, write that in the PR and on this issue with the reason. Do not force a fix.
- Value checks need an independent expected result (oracle). Do not use the output of the code under test as the expected result.
- Run ctest serially. Do not use
-j, because the tests depend on each other. - Format with clang-format 19.1.1 and the repository
.clang-format. - Do not add sentences to the filter documentation about input requirements. The generated parameter table documents them.
- If a fix touches a filter that has a V&V report (
src/Plugins/<Plugin>/vv/<Filter>.md), update every file of the V&V package of that filter (report, deviations, provenance, test tables). V&V documents reference DREAM3D 6.5.171 only. - Rebase on develop. Do not merge develop into the branch.
Checklist
-
WRONG_DATA · ComputeGBCDPoleFigureFilter · ComputeGBCDPoleFigureDirect.cpp:107 — Set Output Image Dimension to an odd value (for example 3). The position uses integer
n/2, so each sample is half a pixel away from the cell center of the created Image Geometry. Scanline has the same formula.ComputeGBCDPoleFigureFilter#4 -
WRONG_DATA · FlyingEdges3DFilter · FlyingEdges.hpp:1287 — Use any Image Geometry with Cell Data.
getPosCubeputs the cube corner atorigin + i*spacing(the cell minimum corner), not at the cell center, so the contour surface is shifted by -0.5 cell on each axis. (related: #1808)FlyingEdges3DFilter#6 -
WRONG_DATA · PointSampleEdgeGeometryFilter · PointSampleEdgeGeometry.cpp:122 — Set Calculate Cumulative Sample Distance = true on any edge. The vertices are placed at
start + halfDel + j*del, but the stored distance isstep*j, so each value is half a step too short. (related: #1797)PointSampleEdgeGeometryFilter#4 -
WRONG_DATA · ReadBinaryCTNorthstarFilter · ReadBinaryCTNorthstar.cpp:80 — Set Length Unit =
Unspecified(choice index 27) orUnknown(index 28). The code casts the index directly toIGeometry::LengthUnit, but those enum values are 100 and 101, so the Image Geometry gets a unit value that is not in the enum.ReadBinaryCTNorthstarFilter#4 -
WRONG_DATA · ReadImageFilter · ReadImageFilter.cpp:148 — Read a
.nrrdfile with Length Unit =Millimeter. The NRRD preflight path creates the Image Geometry without a unit argument, so the geometry gets theMicrometerdefault. Only the raster image path applies Length Unit.ReadImageFilter#4 -
WRONG_DATA · ReadNIfTIFileFilter · ReadNIfTIFileFilter.cpp:249 — Read any NIfTI file with
xyzt_units=NIFTI_UNITS_MM(the usual case for MRI/CT). The filter does not parsexyzt_unitsand does not pass a unit, so the millimeter spacing is labeledMicrometer.ReadNIfTIFileFilter#5 -
WRONG_DATA · ReadVolumeGraphicsFileFilter · ReadVolumeGraphicsFileFilter.cpp:435 — Read a
.vgifile withunit = mmin[geometry](for example the test file). The filter parsesmetadata.Units=Millimeterbut does not pass it toCreateImageGeometryAction, so the geometry getsMicrometer.ReadVolumeGraphicsFileFilter#2 -
WRONG_DATA · WriteVtkRectilinearGridFilter · WriteVtkRectilinearGrid.cpp:44 — Write any Image Geometry. The coordinates start at
origin - 0.5*spacing, but the Image Geometry origin is the minimum corner, so the written grid is shifted by half a cell. (related: #1794)WriteVtkRectilinearGridFilter#1 -
WRONG_DATA · ResampleImageGeomFilter · src/simplnx/Utilities/ImageProcessing/ImageGeometryResample.cpp:80 — Nearest-neighbor resampling uses destination-cell corners instead of centers. For unit source spacing and destination spacing 3, it selects source cells [0,3] instead of [1,4]. Class: C19a; origin: sweep. Mike's PR #1913 overlaps this helper; check its exact patch before editing and avoid duplicating its work.
-
WRONG_DATA · NearestPointFuseRegularGridsFilter · NearestPointFuseRegularGridsDirect.cpp:51 and NearestPointFuseRegularGridsScanline.cpp:36 — Both routes sample reference-cell corners instead of centers and select the wrong source cells. One filter finding covers both routes. Class: C19a; origin: sweep. C07's same-filter findings are different defects. Mike's PR #1913 overlaps the related resampling helper; reconcile that overlap before related coordinate changes.
Related issues
- #1808 BUG: FlyingEdges3D shifts cell-data contours by half a cell (same as
FlyingEdges3DFilter#6) - #1797 BUG: Preserve the endpoint offset in sampled edge distances (same as
PointSampleEdgeGeometryFilter#4) - #1794 BUG: Rectilinear VTK export shifts cell data by half a voxel (same as
WriteVtkRectilinearGridFilter#1)
Close these issues from the PR that fixes the matching finding.
Out of scope
- No finding of this class is in a filter that has a V&V report (0 findings excluded).
- The HDF5 geometry readers cast a stored enum value, not a choice index. They are not part of this class.
- 主要言語
- C++
- スター
- 18
- フォーク
- 15
- 平均マージ
- 4日 23時間
- マージ済み PR(30日)
- 42
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
BlueQuartzSoftware/simplnx のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
BlueQuartzSoftware/simplnx#1987 ·
メンテナーはふだん 6 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
BlueQuartzSoftware/simplnx#1980 ·
メンテナーはふだん 6 日以内に返信
-
Testing
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
BlueQuartzSoftware/simplnx#1979 ·
メンテナーはふだん 6 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
BlueQuartzSoftware/simplnx#1978 ·
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
BlueQuartzSoftware/simplnx#1945 ·
メンテナーはふだん 6 日以内に返信
BlueQuartzSoftware/simplnx の issue をすべて見る
似ている issue
-
bug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
26.04 bug dark-mode Easy Hack impress symptom: visual
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
CollaboraOnline/online#16421 · コメント 1 件 ·
-
area/cs bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ydb-platform/ydb#59881 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
documentation enhancement lua server
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100