Closed blauyang closed 2 years ago
Hi @blauyang.
You are loading the projections from your computer with this code, you never use Tigre forward projection (Ax()). So, it does not matter how much you set Tigre geometry, this won't change the data you have in your hard drive thst you are loading. This is why you see no change, because you dont use Tigre to generate the projections.
The geometry will be important for reconstruction, but its a description of your data, so it doesn't change thr data, if that makes sense.
Do you understand the issue? Do you need more help?
Hi @AnderBiguri, Thank you for such a quick reply. I applied the code to the projection, but the error is reported as follows.:nVoxel does not match with provided image size
for i = 0:99 projectionFilePathCurrent = sprintf(projectionPathPattern,i); im = bth.image.importGrayImage(projectionFilePathCurrent,projectionFileInfo); imSingle = im2single(im); projections(:,:,i+1) = imSingle; end projections=Ax(projections,geo,-angles,'interpolated'); projections=-log(projections/(max(projections(:))+1)); % Beer-Lanbert law,white=metal/bone/high density and black=air. plotProj(projections,angles);
But I'm sure my geometry data is all correct because I've run it successfully without adding an offset of detector and got a reconstruction that looks correct(with just a little artifact compared to the commercial CT results). But my tutor says I should add the detector offset. Also the algorithm I am using is FDK.
Hi @blauyang ,
Apologies, I think you really are not understading. In your original code, there was no call to FDK. You just set up a geometry, and plotted your projections, that you got from your hard drive. The first clear misconception you have is to believe that TIGRE will change the data in your hard drive. This is not true, you can not set up a geometry and that would magically change the data you are loading into TIGRE. Your data is your data.
Now, if you want to reconstruct, your geometry has to be exactly the one of your data. This is true. If you have done that, then you can call FDK on your projections, and that should reconstruct an image. But none of the code you seem to show here has that, so I am still confused what you have issues with.
Ax() is to be called in an image, not in projection data. It is a forward projection. You misunderstood what I meant in my first comment, you don't need Ax() here.
What is the question again? If you call FDK on your data, with correct geometry, do you get a good result?
Hi @AnderBiguri ,
Sorry. I really didn't understand it very well. I actually called the FDK algorithm, I just showed only part of the code at first. Here is the rest of the code. Where should I use Ax()?
%% Reconstruct image with FDK algorithms % FDK imgFDK = FDK(projections,geo,-angles); %Show the results plotImg(imgFDK,'Dim','Z','step',5); %D:\Tigre\Tigre_figure %giffilename='tigre_figure.gif'; %plotImg(imgFDK,'Dim','Z','step',5,'Savegif','tigre_figure.gif'); plotImg(imgFDK,'Dim','Z','slice',300);
@blauyang
Where should I use Ax()?
If you are loading your own data, nowhere.
Unfortunately I still do not know what is your issue :). Is there something that does not work? What?
Hi @AnderBiguri,
I am using my own dataset, but I want to add the offset of the detector, however when I change the offset, I get the wrong reconstructed result (the image is all gray). But when the detector offset is 0, the result looks correct. The project I am working on is comparing commercial CT and Tigre toolkit. I compared the coordinates of both and it seems to be the same. The commercial CT software that I am using has the detector offset included in it. So I was thinking if I should also include the same probe offset in the tigre program.
Hi @AnderBiguri ,
I would like to describe my problem in more detail. This is because my data was collected by real industrial ct equipment. In the definition of the toolbox, the ray source and the centre of the rotary table, as well as the centre of the detector, are in a straight line. But in reality it is not so precise, i.e. there is a certain offset in the position of the ray projection to the detector, so I need to add detector offset. However, I could not find the definition of detector offsets in the toolbox. As a result, the result is even worse after I have added the offset. This is the problem I want to solve. And thanks for your patience:)
There are two possible variables that you may want to set.
1- In microCT, the offset that you see due to the misplacement of the rotary table is not detector offset, its offset of the center of rotation, or COR. You set this in TIGRE with geo.COR
2-Detector offset, as you already found the definition for in the toolbox (you have shown code that sets it up).
I suspect you want 1).
TIGRE can set these and the way you did set them is correct. However, knowinig the exact numerical value of this offset is essential. Any mistake on its value, and you will make the reconstruction worse. Of course, I don't know the real value of your geometry, and without the data and full code, no one can really help.
Hi @AnderBiguri ,
I guess I have always had a wrong understanding of the definition of a coordinate system. Your answer was a great help to me. Thank you very much.
@blauyang great! Let me know if you need more help!
Expected Behavior
The reconstruction I'm doing requires an detector-offset of about 500 pixels in the u v direction respectively, and I've looked carefully at demo14 in the toolbox,
Actual Behavior
but no matter how much the offset is changed in my program, the position of the image on the detector never changes.
Code to reproduce the problem (If applicable)
close; clear all; %% Geometry structure definition. % Distances geo.DSD = 1377.29; % Distance Source Detector geo.DSO = 190.467; % Distance Source Origin % Detector parameters geo.nDetector = [1019; 1024]; % number of pixels geo.dDetector = [0.4; 0.4]; % size in mm of each pixel geo.sDetector = geo.nDetector.*geo.dDetector; % total size of the detector in mm
% Image parameters geo.nVoxel = [717;446;600]; % number of voxels in the image geo.sVoxel = [39.66189808;24.671113883;33.18987287]; % total size of the image in mm geo.dVoxel = geo.sVoxel./geo.nVoxel; % size in mm of each voxel
% Offsets geo.offOrigin = [0; 0; 0]; % V_orig geo.offDetector = [509.8910.4;510.6090.4]; % V_det
angles=linspace(0,2*pi,100);
projectionPathPattern = 'd:/demo/Exampledata/bth7/Corrected%d.uint16'; projectionFileInfo.headerBytes = 0; projectionFileInfo.littleEndian = true; projectionFileInfo.imagePrecisionClass = 'uint16'; projectionFileInfo.sizeIm = [1019,1024];
% load data projections = single(zeros(1024,1019,100));
for i = 0:99 projectionFilePathCurrent = sprintf(projectionPathPattern,i); im = bth.image.importGrayImage(projectionFilePathCurrent,projectionFileInfo); imSingle = im2single(im); projections(:,:,i+1) = imSingle; end projections=-log(projections/(max(projections(:))+1)); % Beer-Lanbert law,white=metal/bone/high density and black=air. plotProj(projections,angles);
Specifications