-
Notifications
You must be signed in to change notification settings - Fork 125
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] Retain sub-second resolution in scans files #451
Conversation
heudiconv/bids.py
Outdated
acq_time = datetime.strptime(td, '%H%M%S%Y%m%d').isoformat() | ||
time = dcm_data.ContentTime | ||
td = time + ':' + date | ||
acq_time = datetime.strptime(td, '%H%M%S.%f:%Y%m%d').isoformat() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is .%f
guaranteed to be present (above code would work without)? I wonder if there should be a check for '.'
to be found in td?
If you could while at it place it into an auxiliary function and give it a dedicated tiny unittest - would be awesome... but if not -- that is ok ;) just feels like worthwhile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Just added a new function in utils, as well as a test for it.
Codecov Report
@@ Coverage Diff @@
## master #451 +/- ##
==========================================
+ Coverage 74.99% 76.14% +1.14%
==========================================
Files 35 36 +1
Lines 2863 2959 +96
==========================================
+ Hits 2147 2253 +106
+ Misses 716 706 -10
Continue to review full report at Codecov.
|
Made it also .000000 just for the sake of making robust since %f expects microseconds
pushed a little tune up and then decided to check BIDS... heh heh https://bids-specification.readthedocs.io/en/stable/03-modality-agnostic-files.html#scans-file
and according to https://tools.ietf.org/html/rfc3339 and https://en.wikipedia.org/wiki/ISO_8601 seems sub-second is allowed (phew) BUT also wikipedia says So I am afraid that
|
I am not yet sure if I like it but here it was pushed. @tsalo could you please raise a question or a PR with bids-specification about .microseconds? ;) |
@yarikoptic My bad, I should have reviewed the specification before opening the issue/PR. I've opened bids-standard/bids-specification#469, so we'll see if we can get microseconds supported. |
That allows to remove code duplication of header column names
d56ecf0
to
fbff77e
Compare
Since BIDS community is so receptive to the change, may be we could just proceed with subsecond in |
So, @tsalo -- should I just drop the last commit and let's proceed with new improved |
@yarikoptic That sounds good to me! |
fbff77e
to
c5fe64f
Compare
ok, done. For the record -- pushed |
Now that bids-standard/bids-specification#470 is merged, can we merge this or should we wait for the validator (https://github.com/bids-standard/bids-validator/issues/957)? |
oh, we definitely should merge ;) |
Various improvements and compatibility/support (dcm2niix, datalad, duecredit) changes. Major change is placement of output files to the target output directory during conversion. - #454 zenodo referencing in README.rst and support for ducredit for heudiconv and reproin heuristic - #445 more tutorial references in README.md - [#485][] placed files during conversion right away into the target directory (with a `_heudiconv???` suffix, renamed into ultimate target name later on), which avoids hitting file size limits of /tmp ([#481][]) and helped to avoid a regression in dcm2nixx 1.0.20201102 - #477 replaced `rec-<magnitude|phase>` with `part-<mag|phase>` now that BIDS supports the part entity - #473 made default for CogAtlasID to be a TODO URL - #459 made AcquisitionTime used for acq_time scans file field - #451 retained sub-second resolution in scans files - #442 refactored code so there is now heudiconv.main.workflow for more convenient use as a Python module - minimal version of nipype set to 1.2.3 to guarantee correct handling of DWI files ([#480][]) - `heudiconvDCM*` temporary directories are removed now ([#462][]) - compatibility with DataLad 0.13 ([#464][]) - #443 pathlib as a dependency (we are Python3 only now) * tag 'v0.9.0': Add a helper rule to upload to pypi update changelog reference as part of prep release [DATALAD RUNCMD] prepare the release CHANGELOG entry for 0.9.0
Various improvements and compatibility/support (dcm2niix, datalad, duecredit) changes. Major change is placement of output files to the target output directory during conversion. - #454 zenodo referencing in README.rst and support for ducredit for heudiconv and reproin heuristic - #445 more tutorial references in README.md - [#485][] placed files during conversion right away into the target directory (with a `_heudiconv???` suffix, renamed into ultimate target name later on), which avoids hitting file size limits of /tmp ([#481][]) and helped to avoid a regression in dcm2nixx 1.0.20201102 - #477 replaced `rec-<magnitude|phase>` with `part-<mag|phase>` now that BIDS supports the part entity - #473 made default for CogAtlasID to be a TODO URL - #459 made AcquisitionTime used for acq_time scans file field - #451 retained sub-second resolution in scans files - #442 refactored code so there is now heudiconv.main.workflow for more convenient use as a Python module - minimal version of nipype set to 1.2.3 to guarantee correct handling of DWI files ([#480][]) - `heudiconvDCM*` temporary directories are removed now ([#462][]) - compatibility with DataLad 0.13 ([#464][]) - #443 pathlib as a dependency (we are Python3 only now) * tag 'v0.9.0': Do no bother ensuring that version changed - should be no changes
Closes #447.
Changes proposed:
acq_time
for scans.tsv files.