InsightSoftwareConsortium / InsightSoftwareConsortium/ITK

ImageIOFactory read tiff image get error pixel type.

Open
#2,959 10 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
I use Photoshop/ImageJ open the test image , both get real pixel type of 16bit. But ITK TIFFIO get UCHAR( 8bit ).

tiffinfo :
![image](https://user-images.githubusercontent.com/8470001/146147676-e132b29d-5436-47b1-8141-eea64e929bac.png)

Fiji:
![image](https://user-images.githubusercontent.com/8470001/146148754-38dff3e7-c8c5-41d4-85f6-69f79d6694f2.png)

### Steps to Reproduce
```C++
#include

int
main(int, char**)
{
std::string filename = "../tiff_bug_1.tif";
itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(
filename.c_str(), itk::ImageIOFactory::ReadMode);

if (imageIO.IsNull()) {
std::cout << "fail create Image io." << std::endl;
return false;
}

imageIO->SetFileName(filename);
imageIO->ReadImageInformation();

const auto pixelType = imageIO->GetComponentType();
std::cout << "image pixel type: " << pixelType << std::endl;
std::cout << "image pixel type: "
<< imageIO->GetComponentTypeAsString(pixelType) << std::endl;
std::cout << "image dim: " << imageIO->GetNumberOfDimensions() << std::endl;
return 0;
}
```

### Expected behavior
Test image real pixel type is unsigned shot(16bit).

### Actual behavior
```
image pixel type: 1
image pixel type: unsigned_char
image dim: 2
```

### Reproducibility

everytime.

### Versions
ITK Version: 5.1.0/5.2.0/master latest

### Environment

CMake: 3.21.1
Compiler: gcc4.8.5/vs2017

### Additional Information
test data 1:
https://drive.google.com/file/d/1O3PCYt6nz1HKuvnZxtbI_U3fox582yAt/view?usp=sharing
sha256: 9201f1ac5888d6c3efbf3055fd6505c84e100383e4f5bb14d7237b1187f77186

test data 2:
https://drive.google.com/file/d/17I1ua6HOtIKV7jQId-10ioJCra6s6i9Z/view?usp=sharing
sha256: b693140a8fdd76765b5091732a0b7db902621b7873588819c783282d9598dd73

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.