CERN/TIGRE

Typos and Errors in VarianCBCT

civerjia opened this issue · 13 comments

Typo1
VarianDataLoader.m and other scripts called this function
line 20 reset(gpuDevice(gpuids.devices(0)+1));
DetectorPointScatterCorrection.m
line 73 and line 103

% Index cannot start from 0 in Matlab
% maybe this ? reset(gpuDevice(gpuids.devices(1)+1));

Typo 2
VarianDataLoader.m
line 99 addParameters(p,'gpuids',GpuIds());
% should be addParameter(p,'gpuids',GpuIds());

3
DetectorPointScatterCorrection.m and other scripts called this function
line 110 proj(:,:,ii) = single(inpaint_nans(double(proj(:,:,ii)), 2));
% function inpaint_nans not exist
% can be replaced by
% fillmissing(proj(:,:,ii),'linear')

4
VarianDataLoader.m
line 53 Blk = DetectorPointScatterCorrection(Blk, geo, ScCalib);
% missing gpuids
% should be Blk = DetectorPointScatterCorrection(Blk, geo, ScCalib, gpuids);

5
ScatterCorrection does not work, Is becomes all NaN at some cases.

Hi @civerjia !

  1. hum, that needs more care, as it hardcodes the gopid, which should not happen, so indeed its wrong, but the solution should be to just use default, or user inputed ids

2)true!

  1. inpaint_nans is a FEX function that can be donwloaded. I believe its not included in TIGRE because they have incompatible licenses, but instructions should (and they don't!) tell you to get that file. This will likely fix 5) too.

  2. yes, likely related to 1) too, the gpuIds are not very well coded there.

My problem with all this is that I do not have access to a Varian dataset so I can not verify and fix the code without possibly introducing more bugs. If you have access to a Varian CBCT dataset, do please test your proposed changes and it would be asewome if you could make a PR with them.

hi @civerjia , I have now made some changes that hopefully should improve the typos. The only one I have not tackled is inpatint_nans, I still think the best option is to download that function, but indeed there is a lack of instruction for it, that I will add. Can you try again?

Well, I'm not working on it right now, I may try it later.

hi @civerjia , I have now made some changes that hopefully should improve the typos. The only one I have not tackled is inpatint_nans, I still think the best option is to download that function, but indeed there is a lack of instruction for it, that I will add. Can you try again?

hi @AnderBiguri , It's looks like typo1 has not been fixed. DetectorPointScatterCorrection (line 74), DetectorPointScatterCorrection (line 107), LogNormal (line 76), and VarianDataLoader (line 20) still report the issues. The gpuids.devices start as 0 but gpuDevice only receive positive integer or []. Maybe +1 is a good way to solve it.

@tianliang774 you must not have updated the code?

e.g. Lognormal 76 reads like this now:
https://github.com/CERN/TIGRE/blob/master/MATLAB/Utilities/IO/VarianCBCT/LogNormal.m#L76

Or do you get a different error? if so, what?

what I see is g = gpuDevice(gpuids.devices(ii));
However, when I run it. I still get error. Because gpuids.devices(1) will return 0 and gpuDevice(0) can not work, at least gpuDevice(1).

https://github.com/CERN/TIGRE/blob/master/MATLAB/Utilities/IO/VarianCBCT/LogNormal.m#L42
For example, you use +1 here.

@tianliang774 ah fair point. I'll fix asap. Apologies, I just don't have Varian data to test, so I more or less winged it.

I can upload a VarianCBCT phantom data

@civerjia that would be lovely!

If you want to make it public (and you have permission), Zenodo is a great place for it.
Otherwise, if you can share it privately only, you can send me an email to ander.biguri@gmail.com and I can store it locally so I can test the codes.

Thanks :)

@AnderBiguri I uploaded a public dataset, here is the link
https://zenodo.org/record/8045749

@civerjia Are you OK with me linking to this repository in TIGRE documentation?

This has been fixed, I can load and reconstruct the provided dataset with no issue!

thanks for the help!

@civerjia Are you OK with me linking to this repository in TIGRE documentation?

Sure