[Gate-users] How convert XXX.HDR from 32 bit to 16 bit using MATLAB

Ville-Veikko Wettenhovi ville-veikko.wettenhovi at uef.fi
Wed Apr 20 15:18:28 CEST 2022


Hi Abdellah,

As a possible automated solution, you could try using the functions Voxelized_phantom_handle.m and saveInterfile.m or saveMetaImage.m from OMEGA (https://github.com/villekf/OMEGA/tree/master/source).

Manually you can do it by using the functions fopen and fread to load the data, manually scaling the data so that it can be converted to integers and then simply use uint16(data) to convert the data. After that, save it as a binary data and manually write a hdr-file (or use the above saveInterfile or saveMetaImage functions).

Regards,
Ville-Veikko Wettenhovi
________________________________
From: Gate-users <gate-users-bounces at lists.opengatecollaboration.org> on behalf of ABDELLAH KITANI <abdellah.kitani at etu.uae.ac.ma>
Sent: Wednesday, April 20, 2022 15:54
To: Gate-users at lists.opengatecollaboration.org <Gate-users at lists.opengatecollaboration.org>
Subject: [Gate-users] How convert XXX.HDR from 32 bit to 16 bit using MATLAB

Hello dear users. I need to convert a voxel phantom using Matlab, and I'm not familiar with matlab. Can anyone here send an example of the codes he/she used  (MATLAB) to convert a xxx.hdr file from float32=>uint16 ???
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20220420/4d2e8d96/attachment.html>


More information about the Gate-users mailing list