CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
560 stars 183 forks source link

d04_SimpleReconstruction.m stops in computeV #318

Closed tsadakane closed 3 years ago

tsadakane commented 3 years ago

Actual Behavior

d04_SimpleReconstruction.m stops in computeV

https://github.com/CERN/TIGRE/blob/568e6c4c0e796741c6947ff91c97fdf7e732cb69/MATLAB/Utilities/computeV.m#L12

>> 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

AnderBiguri commented 3 years ago

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?

tsadakane commented 3 years ago

@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.

AnderBiguri commented 3 years ago

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); ?

tsadakane commented 3 years ago

Adding

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

before https://github.com/CERN/TIGRE/blob/2a5d3962e1c09b0f2d6784f3c2bd7b6b85fa7d0b/MATLAB/Utilities/computeV.m#L12 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.

AnderBiguri commented 3 years ago

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)?

AnderBiguri commented 3 years ago

Thanks @tsadakane , greatly appreciated your efforts!