I have a python program, which generates multiple threads that extracts patches corresponding to various organs from set of common image files. It was all fine until I created an extra thread after which I started encountering IO Error 24: Too many open files.
It appears that nibabel framework, which I use to load medical images, leaves the file open. I am unsure if there is anyway I could force the API to close the file after reading.
I request someone to please help me with this, it is fine if I have to use a different framework, but please make sure that it provides an option to close the file after loading it though.