cabouman / mbircone

BSD 3-Clause "New" or "Revised" License
11 stars 9 forks source link

HDF5 utility function #156

Closed dyang37 closed 8 months ago

dyang37 commented 8 months ago

This PR contains a single function that writes the reconstruction image as an HDF5 file, as well as a demo script to demonstrate the utility function.

Function interface design (approved by Charlie):

def hdf5_write(image, filename,
              recon_description="", alu_description ="", delta_pixel_image=1.0):
    """ This function writes a reconstructed image to an HDF5 file containing the 3D reconstructed volume along with optional descriptions of the source data, and units. 

    Args:
        image (float, ndarray): 3D reconstructed image to be saved.
        filename (string) Path to save the HDF5 file. Example: "<path_to_directory>/recon.h5".
        recon_description (string, optional) [Default=""] description of CT source data.
        alu_description (string, optional) [Default=""] description of arbitrary length units (ALU). Example: "1 ALU = 5 mm".
        delta_pixel_image (float, optional) [Default=1.0]:  Image pixel spacing in ALU.
    """

To test the function, run the demo file demo_hdf5_utils.py.

cabouman commented 8 months ago

Tested and seems to work.

dyang37 commented 8 months ago

Thanks Charlie! Diyu


From: Charles A Bouman @.> Sent: Wednesday, January 31, 2024 2:27 PM To: cabouman/mbircone @.> Cc: Yang, Diyu @.>; Author @.> Subject: Re: [cabouman/mbircone] HDF5 utility function (PR #156)

---- External Email: Use caution with attachments, links, or sharing data ----

Merged #156https://github.com/cabouman/mbircone/pull/156 into master.

— Reply to this email directly, view it on GitHubhttps://github.com/cabouman/mbircone/pull/156#event-11660365666, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB2Q7OHJAXN6V3R4AMIDX63YRKLLVAVCNFSM6AAAAABBVNB4VOVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGY3DAMZWGU3DMNQ. You are receiving this because you authored the thread.Message ID: @.***>