How can I “visualize” 3D image stored (h5py) .h5 format in python?











up vote
-1
down vote

favorite












I want to visualize 3D image stored in .h5 format. I would like to know how can I to it in python. For input , I have file name as '***.h5'










share|improve this question






















  • A general comment is that it best to try a things yourself and post where you get stuck. First, it will limit answers to things that you are interest in (e.g. you might not be interested in using OpenCV but rather want to use matplotlib). Second, you are likely to get stuck at a similar place as others. This way, your question will thus help others. Third, too open questions are very much opinionated, which is not the aim of the platform.
    – Tom de Geus
    Nov 13 at 7:05















up vote
-1
down vote

favorite












I want to visualize 3D image stored in .h5 format. I would like to know how can I to it in python. For input , I have file name as '***.h5'










share|improve this question






















  • A general comment is that it best to try a things yourself and post where you get stuck. First, it will limit answers to things that you are interest in (e.g. you might not be interested in using OpenCV but rather want to use matplotlib). Second, you are likely to get stuck at a similar place as others. This way, your question will thus help others. Third, too open questions are very much opinionated, which is not the aim of the platform.
    – Tom de Geus
    Nov 13 at 7:05













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I want to visualize 3D image stored in .h5 format. I would like to know how can I to it in python. For input , I have file name as '***.h5'










share|improve this question













I want to visualize 3D image stored in .h5 format. I would like to know how can I to it in python. For input , I have file name as '***.h5'







python h5py d3dimage






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 7 at 9:09









Akshay Paranjape

11




11












  • A general comment is that it best to try a things yourself and post where you get stuck. First, it will limit answers to things that you are interest in (e.g. you might not be interested in using OpenCV but rather want to use matplotlib). Second, you are likely to get stuck at a similar place as others. This way, your question will thus help others. Third, too open questions are very much opinionated, which is not the aim of the platform.
    – Tom de Geus
    Nov 13 at 7:05


















  • A general comment is that it best to try a things yourself and post where you get stuck. First, it will limit answers to things that you are interest in (e.g. you might not be interested in using OpenCV but rather want to use matplotlib). Second, you are likely to get stuck at a similar place as others. This way, your question will thus help others. Third, too open questions are very much opinionated, which is not the aim of the platform.
    – Tom de Geus
    Nov 13 at 7:05
















A general comment is that it best to try a things yourself and post where you get stuck. First, it will limit answers to things that you are interest in (e.g. you might not be interested in using OpenCV but rather want to use matplotlib). Second, you are likely to get stuck at a similar place as others. This way, your question will thus help others. Third, too open questions are very much opinionated, which is not the aim of the platform.
– Tom de Geus
Nov 13 at 7:05




A general comment is that it best to try a things yourself and post where you get stuck. First, it will limit answers to things that you are interest in (e.g. you might not be interested in using OpenCV but rather want to use matplotlib). Second, you are likely to get stuck at a similar place as others. This way, your question will thus help others. Third, too open questions are very much opinionated, which is not the aim of the platform.
– Tom de Geus
Nov 13 at 7:05












1 Answer
1






active

oldest

votes

















up vote
1
down vote













Load the file in python like:



import h5py
filename = 'file.hdf5'
f = h5py.File(filename, 'r')


And then check it's type. If it's a numpy array you can use OpenCV or Pillow. If it's not, just make a numpy array from it with f = np.array(f).



OpenCV:



cv.imshow('text', f)
cv.waitKey(0)
cv.destroyAllWindows()


Pillow:



Image.fromarray(f).show()





share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53186363%2fhow-can-i-visualize-3d-image-stored-h5py-h5-format-in-python%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    Load the file in python like:



    import h5py
    filename = 'file.hdf5'
    f = h5py.File(filename, 'r')


    And then check it's type. If it's a numpy array you can use OpenCV or Pillow. If it's not, just make a numpy array from it with f = np.array(f).



    OpenCV:



    cv.imshow('text', f)
    cv.waitKey(0)
    cv.destroyAllWindows()


    Pillow:



    Image.fromarray(f).show()





    share|improve this answer

























      up vote
      1
      down vote













      Load the file in python like:



      import h5py
      filename = 'file.hdf5'
      f = h5py.File(filename, 'r')


      And then check it's type. If it's a numpy array you can use OpenCV or Pillow. If it's not, just make a numpy array from it with f = np.array(f).



      OpenCV:



      cv.imshow('text', f)
      cv.waitKey(0)
      cv.destroyAllWindows()


      Pillow:



      Image.fromarray(f).show()





      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        Load the file in python like:



        import h5py
        filename = 'file.hdf5'
        f = h5py.File(filename, 'r')


        And then check it's type. If it's a numpy array you can use OpenCV or Pillow. If it's not, just make a numpy array from it with f = np.array(f).



        OpenCV:



        cv.imshow('text', f)
        cv.waitKey(0)
        cv.destroyAllWindows()


        Pillow:



        Image.fromarray(f).show()





        share|improve this answer












        Load the file in python like:



        import h5py
        filename = 'file.hdf5'
        f = h5py.File(filename, 'r')


        And then check it's type. If it's a numpy array you can use OpenCV or Pillow. If it's not, just make a numpy array from it with f = np.array(f).



        OpenCV:



        cv.imshow('text', f)
        cv.waitKey(0)
        cv.destroyAllWindows()


        Pillow:



        Image.fromarray(f).show()






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 7 at 9:14









        Novak

        64548




        64548






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53186363%2fhow-can-i-visualize-3d-image-stored-h5py-h5-format-in-python%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud

            Zucchini