(ImagePlus imp)
| 261 | } |
| 262 | |
| 263 | private ImagePlus doProjections(ImagePlus imp) { |
| 264 | int nSlices; // number of slices in volume |
| 265 | int projwidth, projheight; //dimensions of projection image |
| 266 | int xcenter, ycenter, zcenter; //coordinates of center of volume of rotation |
| 267 | int theta; //current angle of rotation in degrees |
| 268 | double thetarad; //current angle of rotation in radians |
| 269 | int sintheta, costheta; //sine and cosine of current angle |
| 270 | int offset; |
| 271 | int curval, prevval, nextval, aboveval, belowval; |
| 272 | int n, nProjections, angle; |
| 273 | boolean minProjSize = true; |
| 274 | |
| 275 | stack = imp.getStack(); |
| 276 | if (imp.getBitDepth()==16 || imp.getBitDepth()==32) { |
| 277 | ImageStack stack2 = new ImageStack(imp.getWidth(),imp.getHeight()); |
| 278 | for (int i=1; i<=stack.size(); i++) |
| 279 | stack2.addSlice(stack.getProcessor(i).convertToByte(true)); |
| 280 | stack = stack2; |
| 281 | } |
| 282 | if ((angleInc==0) && (totalAngle!=0)) |
| 283 | angleInc = 5; |
| 284 | boolean negInc = angleInc<0; |
| 285 | if (negInc) angleInc = -angleInc; |
| 286 | angle = 0; |
| 287 | nProjections = 0; |
| 288 | if (angleInc==0) |
| 289 | nProjections = 1; |
| 290 | else { |
| 291 | while (angle<=totalAngle) { |
| 292 | nProjections++; |
| 293 | angle += angleInc; |
| 294 | } |
| 295 | } |
| 296 | if (angle>360) |
| 297 | nProjections--; |
| 298 | if (nProjections<=0) |
| 299 | nProjections = 1; |
| 300 | if (negInc) angleInc = -angleInc; |
| 301 | |
| 302 | ImageProcessor ip = imp.getProcessor(); |
| 303 | Rectangle r = ip.getRoi(); |
| 304 | left = r.x; |
| 305 | top = r.y; |
| 306 | right = r.x + r.width; |
| 307 | bottom = r.y + r.height; |
| 308 | nSlices = imp.getStackSize(); |
| 309 | imageWidth = imp.getWidth(); |
| 310 | width = right - left; |
| 311 | height = bottom - top; |
| 312 | xcenter = (left + right)/2; //find center of volume of rotation |
| 313 | ycenter = (top + bottom)/2; |
| 314 | zcenter = (int)(nSlices*sliceInterval/2.0+0.5); |
| 315 | |
| 316 | projwidth = 0; |
| 317 | projheight = 0; |
| 318 | if (minProjSize && axisOfRotation!=zAxis) { |
| 319 | switch (axisOfRotation) { |
| 320 | case xAxis: |
no test coverage detected