nbeliy / bidsme

GNU General Public License v2.0
3 stars 0 forks source link

"feature" suggestion: a small library of plugins #4

Closed Remi-Gau closed 4 years ago

Remi-Gau commented 4 years ago

The thought crossed my mind when I realized that bidsme does not do the 3D to 4D conversion "by default".

This seems to be one of the low hanging fruit that should be in a library of plugin because anyone who does functional stuff will have to do this.

Also I think that nibabel can do this so it would not require adding new dependencies.

What do you think?

nbeliy commented 4 years ago

Good point. I will look how make such library

Remi-Gau commented 4 years ago

Another "obvious" one would a plugin to zip the data: I know that most SPM users won't want it because SPM can't deal with zipped data but I would tend to say that many other apps are cool with zipped data.

Plus I would be tempted to still tell SPM users to zip their raw data if only to nudge them to leave the raw data untouched (SPM has the bad habit of just not helping people adopt good data management practices).

nbeliy commented 4 years ago

The zipping data is in plans to be integrated in the main code, with a command line option to switch it on and off. the only difficulty is to how it make general (not only MRI but other modalities also).

Remi-Gau commented 4 years ago

Oh cool !!! Well done. But I understand the headache.

Remi-Gau commented 4 years ago

When you know "where" you would like to host the library of plugins let me know, and I open a PR for the "3D to 4D concatenation" plugin I am working on.

nbeliy commented 4 years ago

For the time delay probably I will make the infrustructure monday. Difficulty is to make the includes optional, do not force the nibabel or pydicom for people who will never use them.

For the concatting 3D to 4D, you need assure 2 things:

Just for help, the recording instance (of Modules.baseModule main class) have a public field files which contains list of all files in current series without path, which can be retrieved using recPath() function. If files are removed, from disc, they must be also removed from this list. So using recording you do not need to rescan folder.

nbeliy commented 4 years ago

I've made a new branch plugin_tools which includes the infrastructure of tools for plugin. It is a "draft" version, so feel free to give suggestions.

Overall it works like this: Folder plugins/tools contains individual "library" files with a definitions of static functions. Each file corresponds to a family tools, organised mostly by the external modules they use. For example General.py use only standard python library. If collection need some external modules (e.g. nibabel), then they must go into separate file. These library files are not loaded automatically (so no init.py), just to not force user to install modules they will not use. Library must have the standard credit/license header (imposed by university), and must include logger -- so std output will be formatted and logged correctly.

In the plugin file, function can be loaded using standard

from plugins.tools.General import CheckSeries

and then function called as usual:

CheckSeries(out_path, Series[session.session])
Remi-Gau commented 4 years ago

OK will have a look but not just right now. :smile:

nbeliy commented 4 years ago

Included in last release, function plugins.tools.Nibabel.Convert3Dto4D