[Insight-developers] GetPixel and SetPixel
Lorensen, William E (CRD)
lorensen at crd.ge.com
Wed Aug 2 06:55:53 EDT 2000
Lydia,
This class is in the process of being revamped. Hopefully, it wil be checked in early next week.
Thanks for the input,
Bill
-----Original Message-----
From: Lydia Ng [mailto:lng at statsci.com]
Sent: Tuesday, August 01, 2000 8:42 PM
To: insight-developers at public.kitware.com
Subject: [Insight-developers] GetPixel and SetPixel
Hi,
I am a newbie to this list, so please excuse me if
this question has been posted before.
I am under the impression that:
1) the data in the Image<,> class is stored
such that the column index is the fastest
varying then row, then slices etc..., and
2) the Index class is defined such that
index[0] = column; index[1] = row; index[3] = slice etc..
If these two observation are right, it seems that
there is an error in Image<,>::SetPixel() and
Image<,>::GetPixel().
In the code below shouldn't
the for loop go from i = 0 to dimension -1 ?
Cheers,
Lydia
----------------------------------------------------
template<class TPixel, unsigned int VImageDimension>
void
Image<TPixel, VImageDimension>
::SetPixel(const Index &ind, const TPixel& value)
{
// FIXME: add bounds checking for the region/image
unsigned long offset=0;
unsigned long prod=1;
const unsigned long *index = ind.GetIndex();
const unsigned long *size = this->GetSize();
unsigned int dimension = this->GetDimension();
// data is arranged as [][][][slice][row][col]
for (int i=dimension-1; i >= 0; i--)
{
offset += prod*index[i];
prod *= size[i];
}
(*m_Data)[offset] = value;
}
----
Lydia Ng, Research Scientist
MathSoft, Inc.
1700 Westlake Ave N, Suite 500
Seattle WA 98109
lng at statsci.com
Tel: 206-283-8802 x308
Fax: 206-283-6310
_______________________________________________
Insight-developers mailing list
Insight-developers at public.kitware.com
http://public.kitware.com/mailman/listinfo/insight-developers
More information about the Insight-developers
mailing list