/* * (non-Javadoc) * @see fr.unistra.pelican.Algorithm#launch() */ public void launch() { int xdim = input.getXDim(); int ydim = input.getYDim(); int zdim = input.getZDim(); int tdim = input.getTDim(); int bdim = input.getBDim(); int vx = (int) (xdim * rx); int vy = (int) (ydim * ry); int vz = (int) (zdim * rz); int vt = (int) (tdim * rt); int vb = (int) (bdim * rb); output = ResamplingByValue.exec(input, vx, vy, vz, vt, vb, resamplingMethod); }
/* * (non-Javadoc) * * @see fr.unistra.pelican.Algorithm#launch() */ public void launch() throws AlgorithmException { int bdim = input.getBDim(); int tdim = input.getTDim(); int zdim = input.getZDim(); int ydim = input.getYDim(); int xdim = input.getXDim(); output = new DoubleImage(xdim, ydim, zdim, tdim, bdim); output.copyAttributes(input); double kok2 = Math.sqrt(2.0); if (input instanceof BooleanImage) throw new AlgorithmException("BooleanImages are not supported"); switch (operation) { case GRADY: for (int b = 0; b < bdim; b++) { for (int t = 0; t < tdim; t++) { for (int z = 0; z < zdim; z++) { for (int y = 1; y < ydim - 1; y++) { for (int x = 1; x < xdim - 1; x++) { double tmp = input.getPixelXYZTBDouble(x - 1, y - 1, z, t, b) + kok2 * input.getPixelXYZTBDouble(x, y - 1, z, t, b) + input.getPixelXYZTBDouble(x + 1, y - 1, z, t, b); tmp = input.getPixelXYZTBDouble(x - 1, y + 1, z, t, b) + kok2 * input.getPixelXYZTBDouble(x, y + 1, z, t, b) + input.getPixelXYZTBDouble(x + 1, y + 1, z, t, b) - tmp; output.setPixelXYZTBDouble(x, y, z, t, b, tmp); } } } } } break; case GRADX: for (int b = 0; b < bdim; b++) { for (int t = 0; t < tdim; t++) { for (int z = 0; z < zdim; z++) { for (int y = 1; y < ydim - 1; y++) { for (int x = 1; x < xdim - 1; x++) { double tmp = input.getPixelXYZTBDouble(x - 1, y - 1, z, t, b) + kok2 * input.getPixelXYZTBDouble(x - 1, y, z, t, b) + input.getPixelXYZTBDouble(x - 1, y + 1, z, t, b); tmp = input.getPixelXYZTBDouble(x + 1, y - 1, z, t, b) + kok2 * input.getPixelXYZTBDouble(x + 1, y, z, t, b) + input.getPixelXYZTBDouble(x + 1, y + 1, z, t, b) - tmp; output.setPixelXYZTBDouble(x, y, z, t, b, tmp); } } } } } break; case NORM: for (int b = 0; b < bdim; b++) { for (int t = 0; t < tdim; t++) { for (int z = 0; z < zdim; z++) { for (int y = 1; y < ydim - 1; y++) { for (int x = 1; x < xdim - 1; x++) { double tmpy = input.getPixelXYZTBDouble(x - 1, y - 1, z, t, b) + kok2 * input.getPixelXYZTBDouble(x, y - 1, z, t, b) + input.getPixelXYZTBDouble(x + 1, y - 1, z, t, b); tmpy = input.getPixelXYZTBDouble(x - 1, y + 1, z, t, b) + kok2 * input.getPixelXYZTBDouble(x, y + 1, z, t, b) + input.getPixelXYZTBDouble(x + 1, y + 1, z, t, b) - tmpy; double tmpx = input.getPixelXYZTBDouble(x - 1, y - 1, z, t, b) + kok2 * input.getPixelXYZTBDouble(x - 1, y, z, t, b) + input.getPixelXYZTBDouble(x - 1, y + 1, z, t, b); tmpx = input.getPixelXYZTBDouble(x + 1, y - 1, z, t, b) + kok2 * input.getPixelXYZTBDouble(x + 1, y, z, t, b) + input.getPixelXYZTBDouble(x + 1, y + 1, z, t, b) - tmpx; double norm = Math.sqrt(tmpx * tmpx + tmpy * tmpy); output.setPixelXYZTBDouble(x, y, z, t, b, norm); } } } } } break; default: for (int b = 0; b < bdim; b++) { for (int t = 0; t < tdim; t++) { for (int z = 0; z < zdim; z++) { for (int y = 1; y < ydim - 1; y++) { for (int x = 1; x < xdim - 1; x++) { double tmpy = input.getPixelXYZTBDouble(x - 1, y - 1, z, t, b) + kok2 * input.getPixelXYZTBDouble(x, y - 1, z, t, b) + input.getPixelXYZTBDouble(x + 1, y - 1, z, t, b); tmpy = input.getPixelXYZTBDouble(x - 1, y + 1, z, t, b) + 2 * input.getPixelXYZTBDouble(x, y + 1, z, t, b) + input.getPixelXYZTBDouble(x + 1, y + 1, z, t, b) - tmpy; double tmpx = input.getPixelXYZTBDouble(x - 1, y - 1, z, t, b) + kok2 * input.getPixelXYZTBDouble(x - 1, y, z, t, b) + input.getPixelXYZTBDouble(x - 1, y + 1, z, t, b); tmpx = input.getPixelXYZTBDouble(x + 1, y - 1, z, t, b) + 2 * input.getPixelXYZTBDouble(x + 1, y, z, t, b) + input.getPixelXYZTBDouble(x + 1, y + 1, z, t, b) - tmpx; double norm = Math.atan(tmpy / tmpx) - 3 * Math.PI / 4; output.setPixelXYZTBDouble(x, y, z, t, b, norm); } } } } } } }