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

オープン
#1,857 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 6 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
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時間
マージ済み PR(30日)
42

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

BlueQuartzSoftware/simplnx のほかの issue

BlueQuartzSoftware/simplnx の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。