Biomedical-Imaging-Group/image-access

Improve execution time of `getNbh()`

Closed this issue · 4 comments

The execution time of getNbh() should be drastically reduced in order to assure fast convolution-like algorithms that utilize this method.

The issue is that getNbh() creates a new IPLabImageAccess object on each call, which takes a lot of time. By avoiding this behaviour we should be able to optimize the function.

A preliminary idea is to create an inheriting class IPLabImageAccessView which only contains pointers to the neighbourhood in question, without replicating the data.

Evaluation (e.g., getPixel()) outside the range of the neighbourhood could be treated by extending the neighbourhood and throwing a warning, by throwing an error to help students spot their mistakes, or by boundary conditions (like now, although that seems weird).

Tested a first (very simple) version of the proposed wrapper class:

image

The first results show a very promising performance gain:

image
All the other accessor functions like getRow, getColumn, getMin ect. and eventually also visualization will be added to create an intuitive interface for the obtained neighbourhood.

This looks good. Maybe create a branch to expose the progress? We work there until it's ready for merging.

It seems you merged this way back. Please re-open if necessary @TheUser0571.