+
+ if (phm.isImagefile()) {
+ // Project through an imagefile
+
+ const ImageFile* im = phm.getImagefile();
+ const ImageFileArray v = im->getArray();
+ int nx = im->nx(), ny = im->ny();
+
+ // Convert endpoints into image pixel coordinates
+ double xmin=0, xmax=nx, ymin=0, ymax=ny; // default coordinate
+ if (! im->getAxisExtent (xmin, xmax, ymin, ymax)) {
+ sys_error(ERR_WARNING, "Axis extent not available [Scanner::projectSingleLine]");
+ }
+ double rect[4];
+ rect[0] = xmin; rect[1] = ymin;
+ rect[2] = xmax; rect[3] = ymax;
+ bool accept = clip_rect (x1, y1, x2, y2, rect);
+ if (! accept)
+ return (0.0);
+
+ double xlen = xmax - xmin, ylen = ymax - ymin;
+ double px1 = nx * (x1 - xmin) / xlen;
+ double px2 = nx * (x2 - xmin) / xlen;
+ double py1 = ny * (y1 - ymin) / ylen;
+ double py2 = ny * (y2 - ymin) / ylen;
+
+ // Use Bresenham integer line stepping to step to each pixel, and walked through image
+
+ sys_error(ERR_WARNING, "Not yet able to project through imagefile. Line (%.3f,%.3f) - (%.3f,%.3f)", px1, py1, px2, py2);
+
+ } else {
+
+ // Project through each pelem in Phantom
+ for (PElemConstIterator i = phm.listPElem().begin(); i != phm.listPElem().end(); i++)
+ rsum += projectLineAgainstPElem (**i, x1, y1, x2, y2);
+ }