InsightSoftwareConsortium / InsightSoftwareConsortium/ITK

Image Writing from Python and C++ give different results

Open
#2,703 6 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

Identical code (written in python & C++) results in different images being written to disk.

The python code writes an image to disk with Identity direction cosine, even though the image supplied to the write function has non-identity cosines. The change occurs somewhere in itk::ImageBase::UpdateOutputInformation().

### Steps to Reproduce
A self-contained environment creates a new virtual environment, builds ITK with python and C++ and runs both the C++ and python test cases from the same source builds is available in the tarball file.

TARBALL: https://github.com/BRAINSia/ITK/raw/debug-python-diffs/failure_case.tar.gz

Download the tarball and run the "do_test.sh" to build (on unix) a clean version of ITK that is instrumented to show the problem.

### Expected behavior

Both the C++ and the python variations should produce identical images on disk.

### Actual behavior

The python generated image has an identity direction cosine.

### Reproducibility

Two different computers (both release and debug mode tested) for two different uses produced the same failures.

### Versions
Latest ITK master branch

### Environment

Ubuntu 20.04 linux.

### Additional Information

Using the "ResampleInPlaceImageFilter".

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.