Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions notebooks/PET/reconstruct_measured_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,17 @@
"# umap.v.hdr is the output converted file\n",
"# Also copy the normalisation header for modification below (using a shorter name).\n",
"!cp $data_path/20170809_NEMA_UCL.n.hdr norm.n.hdr\n",
"!convertSiemensInterfileToSTIR.sh $data_path/20170809_NEMA_MUMAP_UCL.v.hdr umap.v.hdr\n",
"# copy to writeable location\n",
"!cp $data_path/20170809_NEMA_MUMAP_UCL.v.hdr tmp_umap.v.hdr\n",
"!convertSiemensInterfileToSTIR.sh tmp_umap.v.hdr umap.v.hdr\n",
"!rm tmp_umap.v.hdr\n",
"\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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also could we ln -s in lieu of cp?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed a commit... hopefully fine now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

"\n",
"# Now add absolute data path to the header file\n",
"# This command prepends the data path to the data file so that the header in our working folder points to the data\n",
Expand Down