MorphologyOps.foreground_component() ignores connectivity parameter, always uses 1-connectivity
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- computer-vision
Hướng nghiên cứu
Bắt đầu từ MorphologyOps.foreground_component() và so sánh nó với phần khởi tạo và các phương thức khác sử dụng self.connectivity. Hoàn thành khi việc gán nhãn các thành phần liên thông tuân theo tính liên thông đã cấu hình, bao gồm các trường hợp sử dụng như neigh=6.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
-
Class initialization accepts connectivity: 1
-
Other methods use connectivity: Other methods in the codebase properly use the connectivity parameter, as seen in 3
-
Real usage expects different connectivity: In practice, the class is instantiated with different connectivity values, such as
neigh=6in 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.
- Ngôn ngữ chính
- Python
- Star
- 105
- Fork
- 18
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Project-MONAI/MetricsReloaded
-
Documentation: AssignmentMappingĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 50/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 52/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Tất cả issue của Project-MONAI/MetricsReloaded
Issue tương tự
-
comp/cli P3 type/security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
NousResearch/hermes-agent#141420 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
vendor-pitch
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 87/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug llm p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
New tool: ZIPZAX Python Notebook StudioCó thể đã có người làm @github-actions đã nhận hôm nay. Đang mởsubmission triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
kausalflow/tools#226 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100