Skip to content
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

Convert specific file via CLI #142

Open
TheChymera opened this issue Nov 29, 2023 · 4 comments · Fixed by #161
Open

Convert specific file via CLI #142

TheChymera opened this issue Nov 29, 2023 · 4 comments · Fixed by #161
Assignees
Labels
enhancement New feature or request

Comments

@TheChymera
Copy link

TheChymera commented Nov 29, 2023

[deco]~ ❱ brkraw -v
brkraw v0.3.10
[deco]~ ❱ brkraw tonii -o lala.nii.gz /usr/share/opfvta_brudata/20170411_120358_5682_1_4/8/pdata/1/2dseq
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.11/brkraw", line 33, in <module>
    sys.exit(load_entry_point('brkraw==0.3.10', 'console_scripts', 'brkraw')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/brkraw/scripts/brkraw.py", line 152, in main
    study    = BrukerLoader(path)
               ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/brkraw/lib/loader.py", line 104, in __init__
    self._pvobj = load(path)
                  ^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/brkraw/lib/loader.py", line 31, in load
    raise FileNotValidError(path, DataType.PVDATASET)
brkraw.lib.errors.FileNotValidError: (PosixPath('/usr/share/opfvta_brudata/20170411_120358_5682_1_4/8/pdata/1/2dseq'), <DataType.PVDATASET: 1>)

It's a bit confusing that this does not work, and instead I need to use the --scanid and --recoid parameters from which the path then gets constructed, when it would be more transparent to just use the path explicitly.

Would you be interested in supporting this?

@dvm-shlee
Copy link
Member

Hi @TheChymera,

Please try the following command:
brkraw tonii -o lala.nii.gz -s 8 -r 1 /usr/share/opfvta_brudata/20170411_120358_5682_1_4

Could you run this and let me know if you're still encountering the issue? Looking forward to your feedback.

@dvm-shlee
Copy link
Member

@TheChymera, apologies for only reviewing your error message earlier and missing the comments. I've noted that some forks are downloading just the scan folder structure (//pdata/). Implementing a function to target individual scans seems like a valuable addition. I'm exploring the idea of restructuring my PvDataset object to separate scan and reco objects. This would enable image conversion or reconstruction at the individual scan folder level, rather than at the broader scan session (root folder) level. This update is in progress and should be part of the upcoming "v0.4.0" release.

Additionally, regarding the direct conversion of 2dseq files without the necessary metadata, this indeed poses a challenge. A practical solution might be a simple script for conversion, provided the data matrix size and other metadata are known. Considering this, I could potentially develop a straightforward executable script to convert 2dseq files with given matrix sizes. This approach might be what you're looking for, and I can integrate this as a simple plugin, aligning with the plugin architecture currently being implemented in this project.

@dvm-shlee dvm-shlee added the enhancement New feature or request label Feb 1, 2024
@dvm-shlee dvm-shlee added this to the v0.4.0 release milestone Feb 1, 2024
@dvm-shlee dvm-shlee self-assigned this Feb 1, 2024
@dvm-shlee
Copy link
Member

@TheChymera The core module for handling individual files has been developed. Apologies for the delay.

The updated version includes a new script called 'brk_tonifti', which addresses the cases you mentioned. It supports loading entire study directories, scan directories, reco directories, or even individual files like '2dseq', 'visu_pars', etc. The internal Python API is complete, and we expect the script files and documentation to be ready by mid-May. Significant changes have been made to the API.

To indicate that this project has been addressed, I've marked this issue in the pull request concerning the updated API.

All new code has been added as a separate module under both the API and the app, ensuring that the current version's functionality remains unaffected.

@dvm-shlee
Copy link
Member

This feature has not yet been integrated into the CLI. Please reopen this issue to ensure it is addressed appropriately.

@dvm-shlee dvm-shlee moved this from Done to In Progress in BrkRaw v0.4 May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
2 participants