CERN/TIGRE

d04_SimpleReconstruction.m stops in computeV

tsadakane opened this issue · 6 comments

Actual Behavior

d04_SimpleReconstruction.m stops in computeV

maxsize=max(auxgeo.sVoxel+geo.offOrigin(:,auxindex),[],2);

>> d04_SimpleReconstruction
> In Ax (line 71)
  In OS_SART (line 97)
  In d04_SimpleReconstruction (line 47) 
Error using  + 
Matrix dimensions must agree.

Error in computeV (line 12)
        maxsize=max(auxgeo.sVoxel+geo.offOrigin(:,auxindex),[],2);

Error in OS_SART (line 103)
V=computeV(geo,angles,alphablocks,orig_index, gpuids);

Error in d04_SimpleReconstruction (line 47)
imgOSSART=OS_SART(noise_projections,geo,angles,niter);

Code to reproduce the problem (If applicable)

d04_SimpleReconstruction.m

Specifications

  • MATLAB version: R2016a
  • OS: Windows 10
  • CUDA version: 11.1

Hi!
Albeit there was a bug on master introduced on a PR this week (just fixed it), I can not reproduce this issue. It works well on my side. Are you sure you don't have a modified file?
Which python version are you using?

@AnderBiguri Hi. I tested on a fresh workspace of 2a5d3962e1c09b0f2d6784f3c2bd7b6b85fa7d0b.
It occurred on Matlab R2016a+VS2015, but not on Matlab R2021a+VS2019.
The results were the same in the case of 568e6c4c0e796741c6947ff91c97fdf7e732cb69.

I think on MATLAB R2016b they introduced implicit array expansion (before, you'd do this with bsxfun),

However, that is weird, because that line has no need for that, so maybe it should read maxsize=max(auxgeo.sVoxel+geo.offOrigin(:,auxindex).',[],2); ?

Adding

        disp(size(auxgeo.sVoxel));
        disp(size(geo.offOrigin(:,auxindex)));

before

maxsize=max(auxgeo.sVoxel+geo.offOrigin(:,auxindex),[],2);

resulted in

     3     1

     3    20

BTW, maxsize does not seem to be used in this function. I think this line can be commented out.

Ah, that is right. In MATLAB 2016b or bigger, it would add every 3x1 to each 3x1 slice of the 3x30 array. In previous versions, this would require bsxfun or repmat. But I agree, if its not used, comment it out. Can you do it (as you can test it from your side)?

Thanks @tsadakane , greatly appreciated your efforts!