2D Image area and diameter include the flat-axis spacing

未关闭
#1,857 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 6 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
20/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
活跃
技术栈
cpp
领域
backend, data

调研方向

Read src/Plugins/SimplnxCore/vv/deviations/ComputeFeatureSizesFilter.md and the cited calculations in ComputeFeatureSizesDirect.cpp, ComputeFeatureSizesScanline.cpp, and ImageGeom.cpp; the issue first requires a decision on the slab convention. Compare the current behavior with the named tests in ComputeFeatureSizesTest.cpp and GeometryTest.cpp. Done means the convention is decided and applied consistently across the affected filters and geometry code, with tests updated to record the chosen behavior.

由索引模型根据 Issue 内容生成。

描述

bug

Summary

For a 2D Image Geometry (one dimension has size 1), Compute Feature Sizes multiplies all three spacings to get the cell "area". It then calculates the equivalent circle diameter from that value. When the flat dimension's spacing is not 1, the value is a volume, not an area, and the diameter is incorrect. DREAM.3D v6.5.171 uses only the two non-flat spacings.

This behavior came from PR #1590 (e76ad508e). PR #1590 also documents it as the intended "slab" convention in wrapping/python/docs/source/Geometry.rst:37-52: a user who wants a true 2D result must set the flat spacing to 1.0. Thus a fix is a design decision first, and a code change second.

This is deviation ComputeFeatureSizes-D3 in src/Plugins/SimplnxCore/vv/deviations/ComputeFeatureSizesFilter.md.

Example

Four cells, non-flat spacings 2 and 3, flat spacing 5:

  • True area: 4 × 2 × 3 = 24. DREAM.3D v6.5.171 reports 24.
  • SIMPLNX reports 4 × 2 × 3 × 5 = 120.
  • The diameter is too large by a factor of √5.

Affected code (same calculation)

  • src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeFeatureSizesDirect.cpp:173 (diameter at :195)
  • src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeFeatureSizesScanline.cpp:257 (diameter at :261-262)
  • src/simplnx/DataStructure/Geometry/ImageGeom.cpp:150 (findElementSizes). This is the source of the convention. Compute Feature Sizes calls it when Save Element Sizes is on.
  • ComputeNeighborhoods uses the diameter to set the neighborhood radius. In 2D, the larger diameter gives a larger radius.

The RectGrid path in Compute Feature Sizes has no 2D branch. A single-layer RectGrid always gets a volume and an equivalent sphere diameter. That is a different inconsistency.

Other 2D axis defects found in the same check

These are not the slab convention. They are defects under either convention.

  • Compute Biased Features (regression). src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ComputeBiasedFeatures.cpp:232-263. When X or Y is the flat axis, the code swaps the point counts, origins and centroid offsets. The bounding box at line 263 still uses spacing[0] and spacing[1]. DREAM.3D v6.5.171 (FindBoundingBoxFeatures.cpp:350-377) swaps the spacing too. The final check at :318-334 also compares the box against unshifted centroid components. DREAM.3D v6.5.171 has that second defect too.
  • Compute Shapes (inherited). src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/ComputeShapes.cpp, findMoments2D (:432-542) and findAxes2D (:621-664). When X or Y is the flat axis, the moments use the wrong spacing, origin and centroid components. The 2D area written to Volumes (:527) is spacing[0] * spacing[1], so it includes the flat spacing when X or Y is flat. When Z is flat, it is sx·sy, which does not agree with Compute Feature Sizes (sx·sy·sz). DREAM.3D v6.5.171 FindShapes.cpp has the same code.

Checked and correct (or following the documented convention): Compute Feature Neighbors shared surface area, Compute Surface Area To Volume, Compute Largest Cross Sections, Compute Euclidean Distance Map, and the topology-only filters changed in PR #1590.

Compute Feature Neighbors has one documentation error: docs/ComputeFeatureNeighborsFilter.md:26 says the shared surface area is a count of cell faces. The code adds physical face areas.

Tests that record the current behavior

  • ComputeFeatureSizesTest.cpp:1003 ("2D area excludes the flat-dimension spacing", [2DFlatSpacing][!shouldfail]) expects the DREAM.3D value 24 for X, Y and Z flat. It is an expected failure now.
  • ComputeFeatureSizesTest.cpp:327 and :456-466 assert the slab values (volumes == 60, diameter 8.7403879).
  • Create2DImageDataStructure (ComputeFeatureSizesTest.cpp:508) uses flat spacing 1.0, so the "Valid: Image 2D" tests cannot detect the problem.
  • test/GeometryTest.cpp:297-316 asserts the slab convention for findElementSizes.
  • ComputeFeatureNeighborsTest.cpp:167-201 and :417-449 assert slab values for flat X, Y and Z.
  • Compute Shapes has no 2D test. The Compute Biased Features 2D test uses a Z-flat exemplar, so it cannot detect the X/Y-flat defect.

Decisions needed

  1. Keep the slab convention, or change 2D area and diameter to ignore the flat spacing (DREAM.3D v6.5.171 behavior). The answer applies to ImageGeom::findElementSizes, Compute Feature Sizes, Compute Shapes and Compute Feature Neighbors together.
  2. If the slab convention stays: should Compute Feature Sizes call the 2D output an area and calculate a circle diameter from it?
  3. Fix the Compute Biased Features and Compute Shapes axis defects separately. They do not depend on decision 1.
主要语言
C++
星标
18
派生
15
平均合并
4 天 23 小时
30 天内合并 PR
42

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

BlueQuartzSoftware/simplnx 的其他 Issue

查看 BlueQuartzSoftware/simplnx 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。