[SyneRBI/SIRF-Exercises] Update reconstruct_measured_data.ipynb (PR #261)

0 views
Skip to first unread message

Edoardo Pasca

unread,
Jul 3, 2025, 5:12:03 AM7/3/25
to SyneRBI/SIRF-Exercises, Subscribed

You can view, comment on, or merge this pull request online at:

  https://github.com/SyneRBI/SIRF-Exercises/pull/261

Commit Summary

  • 9eeb08c Update reconstruct_measured_data.ipynb

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Exercises/pull/261@github.com>

Kris Thielemans

unread,
Jul 3, 2025, 6:41:01 AM7/3/25
to SyneRBI/SIRF-Exercises, Subscribed

@KrisThielemans commented on this pull request.


In notebooks/PET/reconstruct_measured_data.ipynb:

>      "\n",
     "# These files will sometimes have lines terminated with CR instead of CRLF, fix this\n",
     "# This just means, if we see CR<character> and <character> isn't LF, replace it with CRLF<character>\n",
     "!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" norm.n.hdr\n",
-    "!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" umap.v.hdr\n",
+    "# due to https://github.com/UCL/STIR/issues/1601 we copy the data to the working directory which is the same as where the header lives\n",
+    "! cp $data_path/20170809_NEMA_UCL.n .\n",
+    "#!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" umap.v.hdr\n",

why comment this out? It replaces CRLF with LR, which has nothing to do with all the problems you've seen.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Exercises/pull/261/review/2982670459@github.com>

Casper da Costa-Luis

unread,
Jul 3, 2025, 6:58:01 AM7/3/25
to SyneRBI/SIRF-Exercises, Subscribed

@casperdcl commented on this pull request.


In notebooks/PET/reconstruct_measured_data.ipynb:

>      "\n",
     "# These files will sometimes have lines terminated with CR instead of CRLF, fix this\n",
     "# This just means, if we see CR<character> and <character> isn't LF, replace it with CRLF<character>\n",
     "!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" norm.n.hdr\n",
-    "!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" umap.v.hdr\n",
+    "# due to https://github.com/UCL/STIR/issues/1601 we copy the data to the working directory which is the same as where the header lives\n",
+    "! cp $data_path/20170809_NEMA_UCL.n .\n",
+    "#!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" umap.v.hdr\n",

also could we ln -s in lieu of cp?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Exercises/pull/261/review/2982717168@github.com>

Kris Thielemans

unread,
Jul 3, 2025, 7:07:19 AM7/3/25
to SyneRBI/SIRF-Exercises, Subscribed

@KrisThielemans commented on this pull request.


In notebooks/PET/reconstruct_measured_data.ipynb:

>      "\n",
     "# These files will sometimes have lines terminated with CR instead of CRLF, fix this\n",
     "# This just means, if we see CR<character> and <character> isn't LF, replace it with CRLF<character>\n",
     "!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" norm.n.hdr\n",
-    "!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" umap.v.hdr\n",
+    "# due to https://github.com/UCL/STIR/issues/1601 we copy the data to the working directory which is the same as where the header lives\n",
+    "! cp $data_path/20170809_NEMA_UCL.n .\n",
+    "#!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" umap.v.hdr\n",

would be fine on Unix-type. Not sure about other places. This file is small. I wouldn't bother testing.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Exercises/pull/261/review/2982747061@github.com>

Kris Thielemans

unread,
Jul 3, 2025, 8:44:31 AM7/3/25
to SyneRBI/SIRF-Exercises, Subscribed

@KrisThielemans commented on this pull request.


In notebooks/PET/reconstruct_measured_data.ipynb:

>      "\n",
     "# These files will sometimes have lines terminated with CR instead of CRLF, fix this\n",
     "# This just means, if we see CR<character> and <character> isn't LF, replace it with CRLF<character>\n",
     "!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" norm.n.hdr\n",
-    "!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" umap.v.hdr\n",
+    "# due to https://github.com/UCL/STIR/issues/1601 we copy the data to the working directory which is the same as where the header lives\n",
+    "! cp $data_path/20170809_NEMA_UCL.n .\n",
+    "#!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" umap.v.hdr\n",

@paskino I think you wanted to comment out

!sed -i.bak2 -e \"s#\\(!name of data file:=\\)#\\\\1{data_path}/#\" umap.v.hdr
!sed -i.bak2 -e \"s#\\(!name of data file:=\\)#\\\\1{data_path}/#\" norm.n.hdr

I still need some convincing that this was your problem though.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Exercises/pull/261/review/2983025923@github.com>

Casper da Costa-Luis

unread,
Jul 3, 2025, 8:58:27 AM7/3/25
to SyneRBI/SIRF-Exercises, Push

@casperdcl pushed 1 commit.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Exercises/pull/261/before/9eeb08c71bfa2d693295bd305c3697321e8bf117/after/b25c4c71b498643edc08d777275519a378991a1e@github.com>

Casper da Costa-Luis

unread,
Jul 3, 2025, 8:58:47 AM7/3/25
to SyneRBI/SIRF-Exercises, Subscribed

@casperdcl commented on this pull request.


In notebooks/PET/reconstruct_measured_data.ipynb:

>      "\n",
     "# These files will sometimes have lines terminated with CR instead of CRLF, fix this\n",
     "# This just means, if we see CR<character> and <character> isn't LF, replace it with CRLF<character>\n",
     "!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" norm.n.hdr\n",
-    "!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" umap.v.hdr\n",
+    "# due to https://github.com/UCL/STIR/issues/1601 we copy the data to the working directory which is the same as where the header lives\n",
+    "! cp $data_path/20170809_NEMA_UCL.n .\n",
+    "#!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" umap.v.hdr\n",

pushed a commit... hopefully fine now.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Exercises/pull/261/review/2983071877@github.com>

Kris Thielemans

unread,
Jul 4, 2025, 4:23:12 AM7/4/25
to SyneRBI/SIRF-Exercises, Subscribed

@KrisThielemans commented on this pull request.


In notebooks/PET/reconstruct_measured_data.ipynb:

>      "\n",
     "# These files will sometimes have lines terminated with CR instead of CRLF, fix this\n",
     "# This just means, if we see CR<character> and <character> isn't LF, replace it with CRLF<character>\n",
     "!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" norm.n.hdr\n",
-    "!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" umap.v.hdr\n",
+    "# due to https://github.com/UCL/STIR/issues/1601 we copy the data to the working directory which is the same as where the header lives\n",
+    "! cp $data_path/20170809_NEMA_UCL.n .\n",
+    "#!sed -i.bak \"s/\\r\\([^\\n]\\)/\\r\\n\\1/g\" umap.v.hdr\n",

not yet. we need to change the line below:

!sed -i.bak2 -e \"s#\\(!name of data file:=\\)#\\\\1{data_path}/#\" norm.n.hdr

Likely we don't need it all, i.e. there probably is no path in the norm.n.hdr (there isn't in my copy). Otherwise, we will need to remove the path (which is a more complicated regexp).


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Exercises/pull/261/review/2986065310@github.com>

Kris Thielemans

unread,
Mar 26, 2026, 7:34:30 AM (12 days ago) Mar 26
to SyneRBI/SIRF-Exercises, Subscribed

@KrisThielemans approved this pull request.

These changes shouldn't be necessary with latest STIR, but I'll merge it anyway for older installations.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Exercises/pull/261/review/4013361650@github.com>

Kris Thielemans

unread,
Mar 26, 2026, 7:35:34 AM (12 days ago) Mar 26
to SyneRBI/SIRF-Exercises, Subscribed

Merged #261 into master.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <SyneRBI/SIRF-Exercises/pull/261/issue_event/23929196882@github.com>

Reply all
Reply to author
Forward
0 new messages