Hi,
I am part of the Freesurfer anonymization project mentioned in an earlier thread- sorry to start a new thread but I was unable to reply to the previous one. We are trying to find out how to remove all provenance information from .mgh files.
I am having trouble reading .mgh files into Matlab in order to remove the tags at the end of the file. How would we read and write the tags section of an mgh file in Matlab? Would that be done using any of the Freesurfer Matlab scripts? I haven't had success with viewing or removing tags using load_mgh or MRIread - MRIread displays header information only.
Thanks so much,
Sarah
________________________________ The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.
Hi Sarah
I believe that both load_mgh and MRIread don't load any tags, so if you use them to load, then MRIwrite or save_mgh to write back to disk all the tags should be gone.
cheers Bruce
On Wed, 19 Oct 2016, Keefe, Sarah wrote:
Hi,
I am part of the Freesurfer anonymization project mentioned in an earlier thread- sorry to start a new thread but I was unable to reply to the previous one. We are trying to find out how to remove all provenance information from .mgh files.
I am having trouble reading .mgh files into Matlab in order to remove the tags at the end of the file. How would we read and write the tags section of an mgh file in Matlab? Would that be done using any of the Freesurfer Matlab scripts? I haven't had success with viewing or removing tags using load_mgh or MRIread - MRIread displays header information only.
Thanks so much,
Sarah
The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.
Hi Bruce,
Thanks for your response. When I try to use load_mgh on an mgh file I get an endless output of zeroes that I need to cancel, and when I try to use MRIread like this:
result = MRIread('filepath/file.mgh')
err = MRIwrite(result, 'filepath/file_new.mgh')
It is successful, but the resulting file is 4x larger than the original file.mgh, which is large enough that my editor won't open it so I can't check for the tags. Am I using the commands correctly?
Thanks, Sarah
________________________________ From: freesurfer-bounces@nmr.mgh.harvard.edu freesurfer-bounces@nmr.mgh.harvard.edu on behalf of Bruce Fischl fischl@nmr.mgh.harvard.edu Sent: Wednesday, October 19, 2016 2:58 PM To: Freesurfer support list Subject: Re: [Freesurfer] Freesurfer Matlab scripts for reading and writing files
Hi Sarah
I believe that both load_mgh and MRIread don't load any tags, so if you use them to load, then MRIwrite or save_mgh to write back to disk all the tags should be gone.
cheers Bruce
On Wed, 19 Oct 2016, Keefe, Sarah wrote:
Hi,
I am part of the Freesurfer anonymization project mentioned in an earlier thread- sorry to start a new thread but I was unable to reply to the previous one. We are trying to find out how to remove all provenance information from .mgh files.
I am having trouble reading .mgh files into Matlab in order to remove the tags at the end of the file. How would we read and write the tags section of an mgh file in Matlab? Would that be done using any of the Freesurfer Matlab scripts? I haven't had success with viewing or removing tags using load_mgh or MRIread - MRIread displays header information only.
Thanks so much,
Sarah
The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.
________________________________ The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.
It is saving the output as a float instead of uchar. Try MRIwrite(result,filename,'uchar');
On 10/19/2016 04:38 PM, Keefe, Sarah wrote:
Hi Bruce,
Thanks for your response. When I try to use load_mgh on an mgh file I get an endless output of zeroes that I need to cancel, and when I try to use MRIread like this:
result = MRIread('filepath/file.mgh')
err = MRIwrite(result, 'filepath/file_new.mgh')
It is successful, but the resulting file is 4x larger than the original file.mgh, which is large enough that my editor won't open it so I can't check for the tags. Am I using the commands correctly?
Thanks, Sarah
*From:* freesurfer-bounces@nmr.mgh.harvard.edu freesurfer-bounces@nmr.mgh.harvard.edu on behalf of Bruce Fischl fischl@nmr.mgh.harvard.edu *Sent:* Wednesday, October 19, 2016 2:58 PM *To:* Freesurfer support list *Subject:* Re: [Freesurfer] Freesurfer Matlab scripts for reading and writing files Hi Sarah
I believe that both load_mgh and MRIread don't load any tags, so if you use them to load, then MRIwrite or save_mgh to write back to disk all the tags should be gone.
cheers Bruce
On Wed, 19 Oct 2016, Keefe, Sarah wrote:
Hi,
I am part of the Freesurfer anonymization project mentioned in an
earlier thread- sorry to start a new
thread but I was unable to reply to the previous one. We are trying
to find out how to remove all
provenance information from .mgh files.
I am having trouble reading .mgh files into Matlab in order to
remove the tags at the end of the file.
How would we read and write the tags section of an mgh file
in Matlab? Would that be done using any
of the Freesurfer Matlab scripts? I haven't had success
with viewing or removing tags using load_mgh or
MRIread - MRIread displays header information only.
Thanks so much,
Sarah
The materials in this message are private and may contain Protected
Healthcare Information or other
information of a sensitive nature. If you are not the intended
recipient, be advised that any
unauthorized use, disclosure, copying or the taking of any action in
reliance on the contents of this
information is strictly prohibited. If you have received this email
in error, please immediately notify
the sender via telephone or return mail.
The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
even better! Bruce
On Wed, 19 Oct 2016, Douglas N Greve wrote:
It is saving the output as a float instead of uchar. Try MRIwrite(result,filename,'uchar');
On 10/19/2016 04:38 PM, Keefe, Sarah wrote:
Hi Bruce,
Thanks for your response. When I try to use load_mgh on an mgh file I get an endless output of zeroes that I need to cancel, and when I try to use MRIread like this:
result = MRIread('filepath/file.mgh')
err = MRIwrite(result, 'filepath/file_new.mgh')
It is successful, but the resulting file is 4x larger than the original file.mgh, which is large enough that my editor won't open it so I can't check for the tags. Am I using the commands correctly?
Thanks, Sarah
*From:* freesurfer-bounces@nmr.mgh.harvard.edu freesurfer-bounces@nmr.mgh.harvard.edu on behalf of Bruce Fischl fischl@nmr.mgh.harvard.edu *Sent:* Wednesday, October 19, 2016 2:58 PM *To:* Freesurfer support list *Subject:* Re: [Freesurfer] Freesurfer Matlab scripts for reading and writing files Hi Sarah
I believe that both load_mgh and MRIread don't load any tags, so if you use them to load, then MRIwrite or save_mgh to write back to disk all the tags should be gone.
cheers Bruce
On Wed, 19 Oct 2016, Keefe, Sarah wrote:
Hi,
I am part of the Freesurfer anonymization project mentioned in an
earlier thread- sorry to start a new
thread but I was unable to reply to the previous one. We are trying
to find out how to remove all
provenance information from .mgh files.
I am having trouble reading .mgh files into Matlab in order to
remove the tags at the end of the file.
How would we read and write the tags section of an mgh file
in Matlab? Would that be done using any
of the Freesurfer Matlab scripts? I haven't had success
with viewing or removing tags using load_mgh or
MRIread - MRIread displays header information only.
Thanks so much,
Sarah
The materials in this message are private and may contain Protected
Healthcare Information or other
information of a sensitive nature. If you are not the intended
recipient, be advised that any
unauthorized use, disclosure, copying or the taking of any action in
reliance on the contents of this
information is strictly prohibited. If you have received this email
in error, please immediately notify
the sender via telephone or return mail.
The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
that's because it is saving as float I expect. For load_mgh you need to put a semicolon (;) at the end of the line to suprrss output. If you waant to change back to the original type you could do something like:
[vol,M,mr] = load_mgh('orig.mgz'); save_mgh(vol, 'orig.stripped.mgz', M,mr); quit
mri_convert -ns 1 -rl orig.mgz orig.stripped.mgz orig.stripped.mgz
cheers Bruce
p.s. -ns inhibits scaling, and -rl is "reslice like" so it will give it the same voxel type as orig.mgz
On Wed, 19 Oct 2016, Keefe, Sarah wrote:
Hi Bruce,
Thanks for your response. When I try to use load_mgh on an mgh file I get an endless output of zeroes that I need to cancel, and when I try to use MRIread like this:
result = MRIread('filepath/file.mgh')
err = MRIwrite(result, 'filepath/file_new.mgh')
It is successful, but the resulting file is 4x larger than the original file.mgh, which is large enough that my editor won't open it so I can't check for the tags. Am I using the commands correctly?
Thanks, Sarah
From: freesurfer-bounces@nmr.mgh.harvard.edu freesurfer-bounces@nmr.mgh.harvard.edu on behalf of Bruce Fischl fischl@nmr.mgh.harvard.edu Sent: Wednesday, October 19, 2016 2:58 PM To: Freesurfer support list Subject: Re: [Freesurfer] Freesurfer Matlab scripts for reading and writing files Hi Sarah
I believe that both load_mgh and MRIread don't load any tags, so if you use them to load, then MRIwrite or save_mgh to write back to disk all the tags should be gone.
cheers Bruce
On Wed, 19 Oct 2016, Keefe, Sarah wrote:
Hi,
I am part of the Freesurfer anonymization project mentioned in an earlier thread- sorry to start a new thread but I was unable to reply to the previous one. We are trying to find out how to remove all provenance information from .mgh files.
I am having trouble reading .mgh files into Matlab in order to remove the tags at the end of the file. How would we read and write the tags section of an mgh file in Matlab? Would that be done using any of the Freesurfer Matlab scripts? I haven't had success with viewing or removing tags using load_mgh
or
MRIread - MRIread displays header information only.
Thanks so much,
Sarah
_
The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately
notify
the sender via telephone or return mail.
The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.
freesurfer@nmr.mgh.harvard.edu