[Insight-developers] RawImageIO does not byte swap properly

Lydia Ng lng@insightful.com
Fri, 19 Apr 2002 10:24:10 -0700


Yes, Win-2K, VC++60
- Lydia

> -----Original Message-----
> From: Will Schroeder [mailto:will.schroeder@kitware.com]
> Sent: Friday, April 19, 2002 10:18 AM
> To: Lydia Ng; insight-developers@public.kitware.com
> Subject: Re: [Insight-developers] RawImageIO does not byte=20
> swap properly
>=20
>=20
> Hi Lydia-
>=20
> You are doing this on a Windows platform, yes?
>=20
> Will
>=20
> At 05:33 PM 4/17/2002 -0700, Lydia Ng wrote:
> >Has anyone had success with RawImageIO for reading in
> >unsigned short (16bit) data?
> >
> >I believe the byte swapping logic in RawImageIO::Read() is wrong.
> >
> >Attached is small test 5x5 "unsigned short" test image which is
> >1 2 3 4 5
> >6 7 8 9 10
> >11 12 13 14 15
> >16 17 18 19 20
> >The image is binary and big endian.
> >
> >Also attached is my code for reading it in and writing it to screen.
> >The output I get is
> >256 512 768 1024 1280
> >1536 1792 2048 2304 2560
> >2816 3072 3328 3584 3840
> >4096 4352 4608 4864 5120
> >5376 5632 5888 6144 6400
> >which is definitely a byte swapping problem.
> >
> >----------------------------------------------
> >Secondly the line 205 is also problematic:
> >ByteSwapper<PixelType>::SwapRangeBE((PixelType *)buffer,
> >m_Strides[VImageDimension+1]);
> >
> >For my test case:
> >m_Strides =3D { 2, 2, 10, 50 }
> >
> >ByteSwapper<PixelType>::SwapRangeBE( buffer, N) is suppose
> >to swap N number of PixelType  which in my case
> >should 5 * 5 =3D 25
> >
> >Also, I don't think ByteSwapper with respect to PixelType is=20
> going deal
> >multiple component data properly.
> >----------------------------------------------
> >
> >Can someone have a look at this for me? Thanks.
> >
> >Hoping to get validation completed before d-day .......
> >Lydia
> >
> >
> >z=C8 ?=D7^=BD=E9h=A5=EA=EC(tm)=A8=A5Sx%S=CBHz=C8=20
> =
>?=D7^=BD=E9h=A5=EA=EC=A6=E6=E5?=C9"=B7=ABy=CA&?=DBi=FF=FAnnXoe'+pj=B7oe=A2=
o=E6j)fj=7F=E5S=CBb=9D=FA?S{"']z=F7=A5=A2-=AB
>=20
>=20