706 if ( (pos.
x < min.x) || (pos.
y < min.y) || (pos.
z < min.z)
707 || (pos.
x > max.x) || (pos.
y > max.y) || (pos.
z > max.z) )
712 Vector3 h(pos.
x - min.x, pos.
y - min.y, pos.
z - min.z);
713 double modX = fmod((
double)h.x,stepX);
714 double modY = fmod((
double)h.y,stepY);
715 double modZ = fmod((
double)h.z,stepZ);
717 if (modX==0 && modY==0 && modZ==0)
722 double beforeX = floor(h.x/stepX)*stepX+min.x;
723 double beforeY = floor(h.y/stepY)*stepY+min.y;
724 double beforeZ = floor(h.z/stepZ)*stepZ+min.z;
725 double afterX = ceil(h.x/stepX)*stepX+min.x;
726 double afterY = ceil(h.y/stepY)*stepY+min.y;
727 double afterZ = ceil(h.z/stepZ)*stepZ+min.z;
729 double tx = (pos.
x - beforeX)/stepX;
730 double ty = (pos.
y - beforeY)/stepY;
731 double tz = (pos.
z - beforeZ)/stepZ;
733 result =
getData(
Vector3(beforeX,beforeY,beforeZ))*(
typename ComplexTraits::ComplexPrecision)((1.-tx)*(1.-ty)*(1.-tz));
734 result +=
getData(
Vector3(afterX, beforeY,beforeZ))*(
typename ComplexTraits::ComplexPrecision)( tx *(1.-ty)*(1.-tz));
735 result +=
getData(
Vector3(beforeX,afterY, beforeZ))*(
typename ComplexTraits::ComplexPrecision)((1.-tx)* ty *(1.-tz));
736 result +=
getData(
Vector3(beforeX,beforeY,afterZ ))*(
typename ComplexTraits::ComplexPrecision)((1.-tx)*(1.-ty)* tz );
737 result +=
getData(
Vector3(afterX, afterY, beforeZ))*(
typename ComplexTraits::ComplexPrecision)( tx * ty *(1.-tz));
738 result +=
getData(
Vector3(afterX, beforeY,afterZ ))*(
typename ComplexTraits::ComplexPrecision)( tx *(1.-ty)* tz );
739 result +=
getData(
Vector3(beforeX,afterY, afterZ ))*(
typename ComplexTraits::ComplexPrecision)((1.-tx)* ty * tz );
740 result +=
getData(
Vector3(afterX, afterY, afterZ ))*(
typename ComplexTraits::ComplexPrecision)( tx * ty * tz );
931 if (!from.isInFourierSpace())
934 Size lengthX = from.getMaxXIndex()+1;
935 Size lengthY = from.getMaxYIndex()+1;
936 Size lengthZ = from.getMaxZIndex()+1;
939 Vector3(from.getPhysSpaceMinX(), from.getPhysSpaceMinY(), from.getPhysSpaceMinZ()),
940 Vector3(from.getPhysSpaceMaxX(), from.getPhysSpaceMaxY(), from.getPhysSpaceMaxZ()));
943 double normalization=1./(pow((
float)(lengthX*lengthY*lengthZ),(
int)from.getNumberOfInverseTransforms()));
947 for (
Position i = 0; i < from.size(); i++)
952 y = (i % (lengthY * lengthZ)) / lengthZ;
953 x = i / (lengthY * lengthZ);
958 newGrid[x + (y + z*lengthY)*lengthZ] = dataOut*(
typename ComplexTraits::ComplexPrecision)normalization;
970 Size lengthX = from.getMaxXIndex()+1;
971 Size lengthY = from.getMaxYIndex()+1;
972 Size lengthZ = from.getMaxZIndex()+1;
976 float stepFourierX = from.getFourierStepWidthX();
977 float stepFourierY = from.getFourierStepWidthY();
978 float stepFourierZ = from.getFourierStepWidthZ();
983 Vector3(from.getFourierSpaceMinX(),
984 from.getFourierSpaceMinY(),
985 from.getFourierSpaceMinZ()),
986 Vector3(from.getFourierSpaceMaxX(),
987 from.getFourierSpaceMaxY(),
988 from.getFourierSpaceMaxZ()));
992 double normalization=1./pow(sqrt(2.*
Constants::PI),3)/(pow((
float)(lengthX*lengthY*lengthZ),(
int)from.getNumberOfInverseTransforms()));
1000 for (
Position i = 0; i < from.size(); i++)
1003 y = (i % (lengthY * lengthZ)) / lengthZ;
1004 x = i / (lengthY * lengthZ);
1021 r.
set((
float)x * stepFourierX,
1022 (
float)y * stepFourierY,
1023 (
float)z * stepFourierZ);
1028 newGrid[x + (y + z*lengthY)*lengthZ] = dataOut*(
typename ComplexTraits::ComplexPrecision)normalization*from.phase(r);
1061 y = (i % (lengthY * lengthZ)) / lengthZ;
1062 x = i / (lengthY * lengthZ);
1067 newGrid[x + (y + z*lengthY)*lengthZ] = dataOut.real()*normalization;
1098 signed int xp, yp, zp;
1106 y = (i % (lengthY * lengthZ)) / lengthZ;
1107 x = i / (lengthY * lengthZ);
1128 x-=(int)(lengthX/2.);
1132 x+=(int)(lengthX/2.);
1137 y-=(int)(lengthY/2.);
1141 y+=(int)(lengthY/2.);
1146 z-=(int)(lengthZ/2.);
1150 z+=(int)(lengthZ/2.);
1153 r.
set((
float)xp * stepFourierX,
1154 (
float)yp * stepFourierY,
1155 (
float)zp * stepFourierZ);
1160 newGrid[x + (y + z*lengthY)*lengthZ] = (dataOut*(
typename ComplexTraits::ComplexPrecision)normalization*from.
phase(r)).real();