TomographicImaging / CCPi-Regularisation-Toolkit

The set of CPU/GPU optimised regularisation modules for iterative image reconstruction and other image processing tasks
Apache License 2.0
49 stars 25 forks source link

Oredered Subset: some lines are repeated in all the if-then-else clauses #5

Closed paskino closed 7 years ago

paskino commented 7 years ago

These lines of code are always run and could be ported outside the if-then-else control loop.

https://github.com/vais-ral/CCPi-FISTA_Reconstruction/blob/cb8ef11f00e897b6f5b3049126dd32baa3c50cf9/main_func/FISTA_REC.m#L531 https://github.com/vais-ral/CCPi-FISTA_Reconstruction/blob/cb8ef11f00e897b6f5b3049126dd32baa3c50cf9/main_func/FISTA_REC.m#L553 https://github.com/vais-ral/CCPi-FISTA_Reconstruction/blob/cb8ef11f00e897b6f5b3049126dd32baa3c50cf9/main_func/FISTA_REC.m#L579

dkazanc commented 7 years ago

that's true, actually the whole bunch of code repeated few times, I've been thinking may be wrap it as a function or something?

           `if (strcmp(proj_geom.type,'parallel') || strcmp(proj_geom.type,'fanflat') || strcmp(proj_geom.type,'fanflat_vec'))

                for kkk = 1:SlicesZ
                    [sino_id, sinoT] = astra_create_sino_cuda(X_t(:,:,kkk), proj_geomSUB, vol_geom);
                    sino_updt_Sub(:,:,kkk) = sinoT';
                    astra_mex_data2d('delete', sino_id);
                end
            else

                [sino_id, sino_updt_Sub] = astra_create_sino3d_cuda(X_t, proj_geomSUB, vol_geom);
                astra_mex_data3d('delete', sino_id);
            end`
dkazanc commented 7 years ago

the code has been updated. Importantly projection OS operation must be inside for ss = 1:subsets loop!