BUG: ConvertColorToGrayScale writes all inputs to the first output array

クローズ 初心者向け
#1,759 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

@imikejackson がすでに取り組んでいます。

2026年10月31日 から。

  • #1900 @imikejackson による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp
領域
data, testing

調査の方向性

src/simplnx/Utilities/ImageProcessing/ColorToGrayScale.cpp の 588~599 行付近にある Execute ループから開始し、その後 ConvertColorToGrayScaleTest.cpp を確認します。既存のテストを実行してその動作を確認し、異なる値を持つ少なくとも 2 つの入力配列を使用したカバレッジを追加して、対応する各 Gray_ 出力に正しいグレースケール値が含まれ、他の出力を上書きしていないことを検証します。

索引モデルが issue の本文から書いたものです。

説明

bug

Description

ConvertColorToGrayScaleFilter writes every converted input array to the first output array when the user selects more than one input array.

Preflight makes one output array for each selected input array (<prefix><input name>). Execute does not move to the next output path. outputPathIter is set to begin() and the loop never increments it:

https://github.com/BlueQuartzSoftware/simplnx/blob/282a16cc97430840b9fa1c47956cacefb7931683/src/simplnx/Utilities/ImageProcessing/ColorToGrayScale.cpp#L588-L599

// Current behavior reuses the first output path for every selected input path.
auto outputPathIter = m_InputValues->OutputDataArrayPaths.begin();
for(const auto& arrayPath : m_InputValues->InputDataArrayPaths)
{
  ...
  auto& outputGrayArray = m_DataStructure.getDataRefAs<UInt8Array>(*outputPathIter);
  ...
}

The defect has been in the code since the filter was ported in e135e9de0 (#388). #1568 added the comment above but kept the behavior. #1752 moved the file to src/simplnx/Utilities/ImageProcessing/.

Steps to Reproduce

  1. Create three uint8 color arrays A, B, and C with 3 components and different values.
  2. Run ConvertColorToGrayScaleFilter with all three arrays selected and the prefix Gray_.

Expected: Gray_A, Gray_B, and Gray_C contain the gray-scale values of A, B, and C.

Actual: Gray_A contains the gray-scale values of C, because each pass overwrites the previous one. The filter does not write to Gray_B and Gray_C; they keep their initial values. The filter does not show an error or a warning.

Test Coverage

ConvertColorToGrayScaleTest.cpp selects only one input array, so the tests do not find this defect. A fix must increment outputPathIter after each input array, remove the comment, and add a test that selects two or more input arrays with different values.

主要言語
C++
スター
18
フォーク
15
平均マージ
3日 35分
マージ済み PR(30日)
25

環境構築

はじめの一歩

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

BlueQuartzSoftware/simplnx のほかの issue

BlueQuartzSoftware/simplnx の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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