My code currently projects a radon transform of the image that I have selected, but I would like to know how to create the back projection of the inverse radon transform and reconstruct the image. Here is my code for the forward radon transform:
package radon; import gui.ClosableJFrame; import j2d.ImageUtils; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; public class InverseRadonTransform { public static void main(String[] args) throws InterruptedException { //File f = Futil.getReadFile("select a radon image"); File f = new File("/Users/StephCruz/School/biomed. vis./Midterm/peppers.JPEG"); System.out.println(f); BufferedImage frtImage = ImageUtils.getBufferedImage( ImageUtils.getImage(f)); int w = frtImage.getWidth(); int h = frtImage.getHeight(); double delta_theta = Math.PI / w; ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.setLayout(new GridLayout(1, 3)); BufferedImage outputImage = ImageUtils.getBufferedImage(w,h); RotatedImagePanel frtPanel = new RotatedImagePanel(frtImage); RotatedImagePanel rotatedImagePanel = new RotatedImagePanel(frtImage); OutputImagePanel outputImagePanel = new OutputImagePanel(outputImage); cf.addComponent(frtPanel); cf.addComponent(rotatedImagePanel); cf.addComponent(outputImagePanel); cf.setSize(3 * w, h); cf.setVisible(true); for (int colIndex =0; colIndex < w; colIndex++) { //rti=radon transform image //frt = forward radon transform //bp=back projection outputImagePanel.setBackProj(frtPanel.getCol(colIndex)); double theta = delta_theta* colIndex; rotatedImagePanel.setRotation(theta); //System.out.println("x="+x+" w="+w); rotatedImagePanel.repaint(); outputImagePanel.repaint(); //Thread.sleep(10); } //rotatedImagePanel.repaint(); //outputImagePanel.repaint(); //ImageUtils.saveAsJpeg(outputImagePanel.getOutputImage(), // Futil.getWriteFile("select output image file name")); } }
Thanks for the help!