BUG: C19: Geometry coordinates and length units in 8 filters
Los mantenedores suelen responder en 6 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 42/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C++
- Estrellas
- 18
- Forks
- 15
- Merge medio
- 4 d 23 h
- PR fusionados (30 d)
- 42
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de BlueQuartzSoftware/simplnx
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
BlueQuartzSoftware/simplnx#1987 ·
Los mantenedores suelen responder en 6 días
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
BlueQuartzSoftware/simplnx#1980 ·
Los mantenedores suelen responder en 6 días
-
Testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
BlueQuartzSoftware/simplnx#1979 ·
Los mantenedores suelen responder en 6 días
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
BlueQuartzSoftware/simplnx#1978 ·
Los mantenedores suelen responder en 6 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
BlueQuartzSoftware/simplnx#1945 ·
Los mantenedores suelen responder en 6 días
Todos los issues de BlueQuartzSoftware/simplnx
Issues similares
-
bug triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
26.04 bug dark-mode Easy Hack impress symptom: visual
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
CollaboraOnline/online#16421 · 1 comentario ·
-
area/cs bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
ydb-platform/ydb#59881 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
documentation enhancement lua server
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100