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
Writing network_measures to structure #61
Comments
I am sorry that there is still no .mat .jason output.
My solution is to write a text reader in MATLAB or python.
It seems to only need few lines of code to complete the task.
…On Wed, Jun 30, 2021 at 8:02 AM JohannesWiesner ***@***.***> wrote:
I stumbled upon this thread on google groups
<https://groups.google.com/g/dsi-studio/c/rq2FJRvtE6I/m/Pcd9Pc7VAwAJ>
because I am facing the same problem. It would be nice if network measures
could be exported in a structured form (.mat, .json, etc.). Since the
question is already 3 years I wonder if this has been implemented in the
meantime?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#61>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACDI4MZG63TSUKFCBV3HWDTVMBTPANCNFSM47SF23XQ>
.
|
No worries! :) I just wanted to make sure that I haven't overseen something :) Alright, I will write a python script then to parse the |
Just for completeness - here's my code (could probably be optimized but does what it is supposed to do): def isFloat(string):
try:
float(string)
return True
except ValueError:
return False
with open('571144.src.gz.hcp1065.qsdr.1.25.R73.fib.gz.tt.gz.HCP-MMP.ncount.end.network_measures.txt') as f:
network_measures = [e.split() for e in f.readlines()]
network_measures = {l[0]:l[1:] for l in network_measures}
for k,l in network_measures.items():
if len(l) == 1:
network_measures[k] = float(l[0])
elif len(l) > 1:
network_measures[k] = [float(e) if isFloat(e) else e for e in l] |
Thanks a lot!
I believe many users will find this very helpful.
Frank
…On Wed, Jun 30, 2021 at 10:22 AM JohannesWiesner ***@***.***> wrote:
Just for completeness - here's my code (could probably be optimized but
does what it is supposed to do):
def isFloat(string):
try:
float(string)
return True
except ValueError:
return False
with open('571144.src.gz.hcp1065.qsdr.1.25.R73.fib.gz.tt.gz.HCP-MMP.ncount.end.network_measures.txt') as f:
network_measures = [e.split() for e in f.readlines()]
network_measures = {l[0]:l[1:] for l in network_measures}
for k,l in network_measures.items():
if len(l) == 1:
network_measures[k] = float(l[0])
elif len(l) > 1:
network_measures[k] = [float(e) if isFloat(e) else e for e in l]
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#61 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACDI4K3RA7OND32S5M4TP3TVMSDNANCNFSM47SF23XQ>
.
|
If this would be helpful, here is the function used in qsiprep: https://github.com/PennLINC/qsiprep/blob/master/qsiprep/interfaces/dsi_studio.py#L427 |
Thanks! Wish I have come across this code earlier.
I will create a link in the documentation.
Frank
…On Wed, Jun 30, 2021 at 11:08 AM Matt Cieslak ***@***.***> wrote:
If this would be helpful, here is the function used in qsiprep:
https://github.com/PennLINC/qsiprep/blob/master/qsiprep/interfaces/dsi_studio.py#L427
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#61 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACDI4JOKYOKX5TMRDDKWGDTVMXOTANCNFSM47SF23XQ>
.
|
I stumbled upon this thread on google groups because I am facing the same problem. It would be nice if network measures could be exported in a structured form (.mat, .json, etc.). Since the question is already 3 years I wonder if this has been implemented in the meantime?
The text was updated successfully, but these errors were encountered: