UCL / STIR

Software for Tomographic Image Reconstruction
http://stir.sourceforge.net/
Other
116 stars 95 forks source link

optimisations for `ProjDataInMemory` (SWIG still to do) #611

Open KrisThielemans opened 4 years ago

KrisThielemans commented 4 years ago

C++

ProjData::fill_from and ProjData::copy_to use explicit loops with SegmentByView etc. This is slow.

For ProjDataInMemory we should be able to directly copy via the iterator from/to the buffer. This would currently not work however, as the segments are stored in the wrong order: fill_from and copy_to use order {0,1,-1,2,-2,...}. ProjDataInMemory uses the default order of ProjDataFromStream https://github.com/UCL/STIR/blob/29133a3ffa690b444894b4392aa710e8bb33a42e/src/buildblock/ProjDataFromStream.cxx#L114-L122 which is {....,-2,-1,0,1,2,...}. It seems to me that we should change the constructors https://github.com/UCL/STIR/blob/29133a3ffa690b444894b4392aa710e8bb33a42e/src/buildblock/ProjDataInMemory.cxx#L104-L105 and https://github.com/UCL/STIR/blob/29133a3ffa690b444894b4392aa710e8bb33a42e/src/buildblock/ProjDataInMemory.cxx#L115-L117 to use the {0,1,-1,...} sequence. We can do that by either:

Doing this should speed-up SWIG's to_numpy and SIRF's as_array as it calls copy_to here.

SWIG

KrisThielemans commented 4 years ago

PR coming

KrisThielemans commented 4 years ago

Everything above except the last item (creating an Array first in SWIG) was addressed in #612