[Date Prev][Date Next] [Chronological] [Thread] [Top]

[CTSim-Users] Thanks, and another question



Ian Kay wrote:
> I've been thinking of similar things.  For instance, rather than ray 
> tracing through a phantom, one could ray trace through a real CT image 
> to recreate a sinogram.  

Yes, that could be added.

> I have not done this yet!  One problem that I haven't thought through is 
> how to map the CT numbers to the "density" used by CTsim.  I'm not sure 
> it even matters.  I just haven't thought it through completely.

Using the CT numbers as the density will reconstruct to the CT
numbers.

> The other idea I had, which might be a cute cheat, would be to write a 
> program which would create a phantom description using "rectangles", one 
> for each pixel.   Wow, would this be slow!  A phantom file with 262144 
> objects to project through!  However, it is only done once -- I wonder 
> how slow it would be.   And it would be quick to write something and try 
> it.  

Yes, pretty slow, I imagine.

I've consider this problem, previously. What I've thought of is this:

1) import your 2-d image as a png or dicom image and create an IF
file.

2) Write a if2pj convertor which steps through each rotation and
projection of the rotation. For each project, sums the densities of
the image pixels lying in the projection's path.

- To be reasonably efficient, one would want to use the bresenham's
integer "drawing" algorithm. But, instead of writing a pixel at the
position, instead grab the pixel value at the position

- To reduce aliasing, one would want to use an antialiasing
algorithm. Bresenham's could do this. One way to do this is to add a
scale factor (say 5) to the image size. So, you'd sample at 5x as many
points. At each point, you reduce the scale size. If the line is 45
degress or less, and you're stepping along the x-axis, then points 0-4
will be a x-pixel 0 and points 5-9 would be at x-pixel 1.  The y-pixel
locations will vary as the slope of the line. With this technique,
you're doing integer stepping along the image, antialiasing, and not
increasing any storage requirements.

So, while I've thought through an efficient algorithm, I'm not
currently planning on coding it.

If you are interested in coding it, I do have code for Bresenham's
line drawing in ctsim/libctgraphics/bresenham.cpp that can be
adapted. This is vestigal code not currently used. I was using it back
when CTSim was running on my IBM-PC with a CGA adapter and I was
running my own line drawing routines.

Kevin



Please send sugestions and comments to kevin@ctsim.org.