InsightSoftwareConsortium / InsightSoftwareConsortium/ITK

itkWarningMacro output streams to Jupyter server console (not the notebook)

Open
#4,690 4 comments 0 reactions 0 assignees View on GitHub
type:Bug
Dominant language
C++
Stars
1.7k
Forks
748
Avg merge
1d 1h
Merged PRs (30d)
64

Description

### Description

When using itk inside a jupyter notebook, warnings triggered by itkWarningMacro (and possibly others) are streamed to the server console instead of the notebook.

### Steps to Reproduce

```python
directory = pathlib.Path('/path/to/dicom/')
filepaths = sorted(directory.glob('*.dcm'))
del filepaths[2] # remove an image slice from the list to trigger non-uniform sampling warning
reader = itk.ImageSeriesReader.IF3.New()
reader.SetFileNames(filepaths)
reader.Update()
```

### Expected behavior

The following warning should appear in the notebook:
```
WARNING: In C:\P\IPP\ITK-source\ITK\Modules\IO\ImageBase\include\itkImageSeriesReader.hxx, line 478
ImageSeriesReader (XXX): Non uniform sampling or missing slices detected, maximum nonuniformity:XXX
```

### Actual behavior

The warning only appears in the jupyter server console.

### Reproducibility

Happens every time.

### Versions

Tested on v5.3 and v5.4.

### Environment

Tested on Windows 10 and 11.

### Additional Information

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.