-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENH]: Handling of relative paths for user-defined masks/parcellations #212
Comments
Actually, maybe it makes sense to provide a YAML interface for the
Then one can treat this as a relative path from YAML similar to other things, but not sure if this will then end up cluttering the YAML and will also not solve the problem for other extensions that still may or may not rely on relative paths to some degree. Perhaps something like allowing user made script-based extensions to use command line arguments. For example one could make a python script to register the parcellation like:
The arguments could then be parametrised in the YAML, so that paths can be treated as relative from there:
Or one could impose some constraint, like, the argument could be a path from yaml to a directory that contains all of the extension data ressources. I think the other option, that is also a good option, just stick with the implementation and just document it really well and explictly, to prevent confusion early on. |
These seems nice concepts that I have not considered. I will just think while I type. The main goals of YAML are:
Option 1) from your suggestion (adding a Additionally, users that want their specific masks/parcellations should be able to create them. At this point, we consider them power users and assume that they have enough coding knowledge to write the .py file that registers the mask. Option 2 is a bit more complicated. First, it allows the user to "code" within the yaml. Second, the items in the Overall, we need to consider what the user is doing, and not only the feature we want to support. My take is:
1 and 2 also applies for masks. Let's also keep in mind that we have pending a nice feature regarding masks: https://www.templateflow.org/ from templateflow import api as tflow
tflow.get('MNI152NLin6Asym', desc=None, resolution=1,
suffix='T1w', extension='nii.gz')
PosixPath('/templateflow_home/tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-01_T1w.nii.gz') |
I agree with all the points above. I think if users that make extensions are considered power users they can be expected to understand the subtleties of the relative paths issue, so my leaning would be towards keeping the implementation as is (paths in the YAML relative from the YAML, paths in extensions relative from the junifer working directory), and simply summarising in the docs quite well how the paths are intended to be used in each situation. |
From another POV:
|
I don't completely understand your approach @synchon What we want to address here is relative paths in Imagine this structure of a github repo in which juni-farm is added as a submodule in the
My take:
|
I got it correct the previous time and I see what you mean. My proposal was a bit holistic in a way:
.juniferignore:
.juniferignore:
.juniferignore:
.juniferignore:
|
But with your approach a junifer config goes from a yaml file to a directory structure. This will mean that the For me, it makes things too complicated. We need to consider the logic from our side, modifying the user's behaviour as less as possible. |
I see your point and have no arguments against it. For me, a documented directory structure brings order to chaos and keeps the user and devs on same page, else I have usually found it to not go down well. Those were my two cents. |
Are you requiring a new dataset or marker?
Which feature do you want to include?
Following the discussion in #127, we need a way of allowing the user to create an extension that registers a mask/parcel using a relative path to the mask (from the location of the .py extensions file).
Asking for absolute paths directly will not work in cases that extensions are stored in a repository, like juni-farm.
The issues comes with the
queue
command, as the .py file will be copied, but the data/parcellation/etc will not.@LeSasse @synchon
How do you imagine this integrated in junifer?
I don't have a clear idea on how to do it, but I can imagine something like this.
.py
file with the extension has a "list of resources" that need to be copied (maybe in a variable, or comment)queue
command:2.1 parses the file
2.2 finds the list of resources
2.3 computes the absolute path
2.4 copies them to a
data
directory in thejunifer_jobs
directory.One problem that this issue has is that the
.py
file needs to somehow be modified so the path of the resources, after thequeue
command, are changed to the newdata
directory in thejunifer_jobs
directory.Maybe some function
junifer_path('../relative/path/to/data.nii.gz', __FILE__)
can take care of solving the relative path. This function will first check in the./data
directory before usingPath(__FILE__).parent
.Other more strict but easier to implement option is that each extension has a
data
directory next to it that can be copied in the junifer jobs. The problem with this approach is that users might end up repeating data in repositories for each extension they create.Do you have a sample code that implements this outside of junifer?
No response
Anything else to say?
No response
The text was updated successfully, but these errors were encountered: