This is my next problem. If anybody wants to add their 2 cents...
We have three dimensional data in a 2-d image. We transform it into a 3-d image cube. The code figures where to find in the 2-d image the data for a point in the 3-d cube. Now I need to reverse this as follows: From the position in the 2-d image go x pixels in one direction. Figure out where in the 3-d cube that data goes.
We have three dimensional data in a 2-d image. We transform it into a 3-d image cube. The code figures where to find in the 2-d image the data for a point in the 3-d cube. Now I need to reverse this as follows: From the position in the 2-d image go x pixels in one direction. Figure out where in the 3-d cube that data goes.
Code:
for(lensx = 0; lensx < CUBEWIDTH; lensx++)
{
for(lensy = 0; lensy < CUBEWIDTH; lensy++)
{
if(lookuptable[lensx][lensy][2] > 0)
{
Xref = lookuptable[lensx][lensy][0] + Token.xshift;
Yref = lookuptable[lensx][lensy][1] + Token.yshift;
height = heightmap[lensy*CUBEWIDTH + lensx];
tilt = tiltmap[lensy*CUBEWIDTH + lensx];
vertscale = VERT_SCALE_DELTA/height;
for(w = 0; w < NCHAN; w++)
{
lambda = LAMBDA_MIN + LAMBDA_INC*w;
crudeXcntr = (int)lroundf(Xref + (LAMBDA_REF - lambda)/vertscale*tilt);
crudeYcntr = (int)lroundf(Yref + (LAMBDA_REF - lambda)/vertscale);