How to read tif file using vtkImageReader2

Hi everyone,

I have some 16-bit 3D tif files to be read. For some reason vtkTIFFReader cannot read them. However, both ImageJ and ParaView can read and display the images without a problem. So I assumed that there could be something wrong with their headers(?) and decided to read them with vtkImageReader2. Now these tif files can be read, but not correctly. Can anyone please tell me how to use vtkImageReader2 to read tif file correctly?

Here’s the code:
vtkImageReader2* terafly1 = vtkImageReader2::New();
terafly1->SetFileName(“C:\Users\hkuo9\Desktop\test2.tif”);
terafly1->SetDataByteOrderToLittleEndian();
terafly1->SetDataExtent(0, 196, 0, 239, 0, 181);
terafly1->SetDataSpacing(1, 1, 1);
terafly1->SetDataOrigin(0, 0, 0);
terafly1->UpdateWholeExtent();
terafly1->Update();

I’m new to this forum so I cannot attach any files to my post yet. I’ll be more than happy to send some example tifs through email or message.

Thanks!