Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

MorphologyOps.foreground_component() ignores connectivity parameter, always uses 1-connectivity

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

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

評価

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

調査の方向性

MorphologyOps.foreground_component() から始め、初期化および self.connectivity を使用する他のメソッドと比較します。neigh=6 のような使用例も含め、連結成分のラベリングが設定された連結性を尊重すれば完了です。

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

説明

Problem Description

The MorphologyOps class in 1 accepts a connectivity parameter during initialization, but the foreground_component() method 2 completely ignores this parameter and always uses scipy's default 1-connectivity (4-connectivity for 2D, 6-connectivity for 3D).

Current Behavior
def foreground_component(self):
    return ndimage.label(self.binary_map)  # No structure parameter specified

When scipy.ndimage.label() is called without the structure parameter, it defaults to:

structure = _morphology.generate_binary_structure(input.ndim, 1)  # 1-connectivity
Expected Behavior

The method should respect the connectivity parameter passed during class initialization, similar to how other methods in the class use self.connectivity.

Evidence of Inconsistency
  1. Class initialization accepts connectivity: 1

  2. Other methods use connectivity: Other methods in the codebase properly use the connectivity parameter, as seen in 3

  3. Real usage expects different connectivity: In practice, the class is instantiated with different connectivity values, such as neigh=6 in 4

Proposed Solution

Modify the foreground_component() method to use the stored connectivity parameter:

def foreground_component(self):
    structure = generate_binary_structure(self.binary_map.ndim, self.connectivity)
    return ndimage.label(self.binary_map, structure=structure)
Impact

This inconsistency may lead to unexpected results in connected component analysis, especially for users who expect the specified connectivity to be applied consistently across all morphological operations.

主要言語
Python
スター
104
フォーク
18
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

Project-MONAI/MetricsReloaded のほかの issue

Project-MONAI/MetricsReloaded の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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