Error reading mhd files with SimpleITK in Python











up vote
1
down vote

favorite












I'm here again with another question regarding SimpleITK in python. I want to plot a .mhd image but I don't know how. I'm trying the function described here Reading *.mhd/*.raw format in python:



load_itk('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')


But it is not reading the image:



RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/SimpleITK-build/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx:483:
itk::ERROR: MetaImageIO(0x3a83730): File cannot be read: /home/bianca/Documents/PythonProcessing/result-Edep.mhd for reading.
Reason: Success


I have tried with scikit image too...



img = io.imread('/home/bianca/Documents/PythonProcessing/result-Edep.mhd', plugin='simpleitk')


but I'm also getting an error message



RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/SimpleITK-build/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx:483:
itk::ERROR: MetaImageIO(0x3a84280): File cannot be read: /home/bianca/Documents/PythonProcessing/result-Edep.mhd for reading.
Reason: Success


Even with medpy



from medpy.io import load
image_data, image_header = load('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')

Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
image_data, image_header = load('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')
File "medpy/io/load.py", line 201, in load
raise err
DependencyError: Loading images of type Itk/Vtk MetaImage (.mhd, .mha/.raw) requires a third-party module that could not be encountered. Reason: No module named itk.


But I do have SimpleITK now. I don't understand what's going on... =(










share|improve this question


























    up vote
    1
    down vote

    favorite












    I'm here again with another question regarding SimpleITK in python. I want to plot a .mhd image but I don't know how. I'm trying the function described here Reading *.mhd/*.raw format in python:



    load_itk('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')


    But it is not reading the image:



    RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/SimpleITK-build/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx:483:
    itk::ERROR: MetaImageIO(0x3a83730): File cannot be read: /home/bianca/Documents/PythonProcessing/result-Edep.mhd for reading.
    Reason: Success


    I have tried with scikit image too...



    img = io.imread('/home/bianca/Documents/PythonProcessing/result-Edep.mhd', plugin='simpleitk')


    but I'm also getting an error message



    RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/SimpleITK-build/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx:483:
    itk::ERROR: MetaImageIO(0x3a84280): File cannot be read: /home/bianca/Documents/PythonProcessing/result-Edep.mhd for reading.
    Reason: Success


    Even with medpy



    from medpy.io import load
    image_data, image_header = load('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')

    Traceback (most recent call last):
    File "<pyshell#17>", line 1, in <module>
    image_data, image_header = load('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')
    File "medpy/io/load.py", line 201, in load
    raise err
    DependencyError: Loading images of type Itk/Vtk MetaImage (.mhd, .mha/.raw) requires a third-party module that could not be encountered. Reason: No module named itk.


    But I do have SimpleITK now. I don't understand what's going on... =(










    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I'm here again with another question regarding SimpleITK in python. I want to plot a .mhd image but I don't know how. I'm trying the function described here Reading *.mhd/*.raw format in python:



      load_itk('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')


      But it is not reading the image:



      RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/SimpleITK-build/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx:483:
      itk::ERROR: MetaImageIO(0x3a83730): File cannot be read: /home/bianca/Documents/PythonProcessing/result-Edep.mhd for reading.
      Reason: Success


      I have tried with scikit image too...



      img = io.imread('/home/bianca/Documents/PythonProcessing/result-Edep.mhd', plugin='simpleitk')


      but I'm also getting an error message



      RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/SimpleITK-build/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx:483:
      itk::ERROR: MetaImageIO(0x3a84280): File cannot be read: /home/bianca/Documents/PythonProcessing/result-Edep.mhd for reading.
      Reason: Success


      Even with medpy



      from medpy.io import load
      image_data, image_header = load('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')

      Traceback (most recent call last):
      File "<pyshell#17>", line 1, in <module>
      image_data, image_header = load('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')
      File "medpy/io/load.py", line 201, in load
      raise err
      DependencyError: Loading images of type Itk/Vtk MetaImage (.mhd, .mha/.raw) requires a third-party module that could not be encountered. Reason: No module named itk.


      But I do have SimpleITK now. I don't understand what's going on... =(










      share|improve this question













      I'm here again with another question regarding SimpleITK in python. I want to plot a .mhd image but I don't know how. I'm trying the function described here Reading *.mhd/*.raw format in python:



      load_itk('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')


      But it is not reading the image:



      RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/SimpleITK-build/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx:483:
      itk::ERROR: MetaImageIO(0x3a83730): File cannot be read: /home/bianca/Documents/PythonProcessing/result-Edep.mhd for reading.
      Reason: Success


      I have tried with scikit image too...



      img = io.imread('/home/bianca/Documents/PythonProcessing/result-Edep.mhd', plugin='simpleitk')


      but I'm also getting an error message



      RuntimeError: Exception thrown in SimpleITK ReadImage: /tmp/SimpleITK-build/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx:483:
      itk::ERROR: MetaImageIO(0x3a84280): File cannot be read: /home/bianca/Documents/PythonProcessing/result-Edep.mhd for reading.
      Reason: Success


      Even with medpy



      from medpy.io import load
      image_data, image_header = load('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')

      Traceback (most recent call last):
      File "<pyshell#17>", line 1, in <module>
      image_data, image_header = load('/home/bianca/Documents/PythonProcessing/result-Edep.mhd')
      File "medpy/io/load.py", line 201, in load
      raise err
      DependencyError: Loading images of type Itk/Vtk MetaImage (.mhd, .mha/.raw) requires a third-party module that could not be encountered. Reason: No module named itk.


      But I do have SimpleITK now. I don't understand what's going on... =(







      python image-processing computer-vision itk simpleitk






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jul 24 '17 at 20:04









      user

      378




      378
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          Is the file you are trying to read valid? You can check that using some other image displaying tool, e.g. ITK-SNAP or 3D Slicer. If either of these tools can open it, please tell us the version of SimpleITK you are using.






          share|improve this answer

















          • 3




            MHD Files typically require an mhd header and a raw file that contains the image data - do you have both in the same directory with the mhd header pointing to the data?
            – g.stevo
            Jul 24 '17 at 23:34










          • Dzenan, thank you for your answer! Now it's reading the file thanks to g.stevo clue (it was missing the raw file). However, now I don't know how to display the image... (I believe you can guess that I'm just a beginner =/)
            – user
            Jul 25 '17 at 18:42










          • Have you seen this: insightsoftwareconsortium.github.io/SimpleITK-Notebooks
            – Dženan
            Jul 25 '17 at 20:19










          • If the above notebooks don't help try googling "SimpleITK Python tutorial" and following something.
            – Dženan
            Jul 25 '17 at 20:21










          • @g.stevo Your comment should be an answer, since that's what I missed in my case. All the best!
            – Бојан Матовски
            Nov 15 at 14:00


















          up vote
          0
          down vote













          MHD Files typically require an mhd header and a raw file that contains the image data - do you have both in the same directory with the mhd header pointing to the data?






          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%2f45289142%2ferror-reading-mhd-files-with-simpleitk-in-python%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            Is the file you are trying to read valid? You can check that using some other image displaying tool, e.g. ITK-SNAP or 3D Slicer. If either of these tools can open it, please tell us the version of SimpleITK you are using.






            share|improve this answer

















            • 3




              MHD Files typically require an mhd header and a raw file that contains the image data - do you have both in the same directory with the mhd header pointing to the data?
              – g.stevo
              Jul 24 '17 at 23:34










            • Dzenan, thank you for your answer! Now it's reading the file thanks to g.stevo clue (it was missing the raw file). However, now I don't know how to display the image... (I believe you can guess that I'm just a beginner =/)
              – user
              Jul 25 '17 at 18:42










            • Have you seen this: insightsoftwareconsortium.github.io/SimpleITK-Notebooks
              – Dženan
              Jul 25 '17 at 20:19










            • If the above notebooks don't help try googling "SimpleITK Python tutorial" and following something.
              – Dženan
              Jul 25 '17 at 20:21










            • @g.stevo Your comment should be an answer, since that's what I missed in my case. All the best!
              – Бојан Матовски
              Nov 15 at 14:00















            up vote
            1
            down vote













            Is the file you are trying to read valid? You can check that using some other image displaying tool, e.g. ITK-SNAP or 3D Slicer. If either of these tools can open it, please tell us the version of SimpleITK you are using.






            share|improve this answer

















            • 3




              MHD Files typically require an mhd header and a raw file that contains the image data - do you have both in the same directory with the mhd header pointing to the data?
              – g.stevo
              Jul 24 '17 at 23:34










            • Dzenan, thank you for your answer! Now it's reading the file thanks to g.stevo clue (it was missing the raw file). However, now I don't know how to display the image... (I believe you can guess that I'm just a beginner =/)
              – user
              Jul 25 '17 at 18:42










            • Have you seen this: insightsoftwareconsortium.github.io/SimpleITK-Notebooks
              – Dženan
              Jul 25 '17 at 20:19










            • If the above notebooks don't help try googling "SimpleITK Python tutorial" and following something.
              – Dženan
              Jul 25 '17 at 20:21










            • @g.stevo Your comment should be an answer, since that's what I missed in my case. All the best!
              – Бојан Матовски
              Nov 15 at 14:00













            up vote
            1
            down vote










            up vote
            1
            down vote









            Is the file you are trying to read valid? You can check that using some other image displaying tool, e.g. ITK-SNAP or 3D Slicer. If either of these tools can open it, please tell us the version of SimpleITK you are using.






            share|improve this answer












            Is the file you are trying to read valid? You can check that using some other image displaying tool, e.g. ITK-SNAP or 3D Slicer. If either of these tools can open it, please tell us the version of SimpleITK you are using.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jul 24 '17 at 22:11









            Dženan

            1,59911930




            1,59911930








            • 3




              MHD Files typically require an mhd header and a raw file that contains the image data - do you have both in the same directory with the mhd header pointing to the data?
              – g.stevo
              Jul 24 '17 at 23:34










            • Dzenan, thank you for your answer! Now it's reading the file thanks to g.stevo clue (it was missing the raw file). However, now I don't know how to display the image... (I believe you can guess that I'm just a beginner =/)
              – user
              Jul 25 '17 at 18:42










            • Have you seen this: insightsoftwareconsortium.github.io/SimpleITK-Notebooks
              – Dženan
              Jul 25 '17 at 20:19










            • If the above notebooks don't help try googling "SimpleITK Python tutorial" and following something.
              – Dženan
              Jul 25 '17 at 20:21










            • @g.stevo Your comment should be an answer, since that's what I missed in my case. All the best!
              – Бојан Матовски
              Nov 15 at 14:00














            • 3




              MHD Files typically require an mhd header and a raw file that contains the image data - do you have both in the same directory with the mhd header pointing to the data?
              – g.stevo
              Jul 24 '17 at 23:34










            • Dzenan, thank you for your answer! Now it's reading the file thanks to g.stevo clue (it was missing the raw file). However, now I don't know how to display the image... (I believe you can guess that I'm just a beginner =/)
              – user
              Jul 25 '17 at 18:42










            • Have you seen this: insightsoftwareconsortium.github.io/SimpleITK-Notebooks
              – Dženan
              Jul 25 '17 at 20:19










            • If the above notebooks don't help try googling "SimpleITK Python tutorial" and following something.
              – Dženan
              Jul 25 '17 at 20:21










            • @g.stevo Your comment should be an answer, since that's what I missed in my case. All the best!
              – Бојан Матовски
              Nov 15 at 14:00








            3




            3




            MHD Files typically require an mhd header and a raw file that contains the image data - do you have both in the same directory with the mhd header pointing to the data?
            – g.stevo
            Jul 24 '17 at 23:34




            MHD Files typically require an mhd header and a raw file that contains the image data - do you have both in the same directory with the mhd header pointing to the data?
            – g.stevo
            Jul 24 '17 at 23:34












            Dzenan, thank you for your answer! Now it's reading the file thanks to g.stevo clue (it was missing the raw file). However, now I don't know how to display the image... (I believe you can guess that I'm just a beginner =/)
            – user
            Jul 25 '17 at 18:42




            Dzenan, thank you for your answer! Now it's reading the file thanks to g.stevo clue (it was missing the raw file). However, now I don't know how to display the image... (I believe you can guess that I'm just a beginner =/)
            – user
            Jul 25 '17 at 18:42












            Have you seen this: insightsoftwareconsortium.github.io/SimpleITK-Notebooks
            – Dženan
            Jul 25 '17 at 20:19




            Have you seen this: insightsoftwareconsortium.github.io/SimpleITK-Notebooks
            – Dženan
            Jul 25 '17 at 20:19












            If the above notebooks don't help try googling "SimpleITK Python tutorial" and following something.
            – Dženan
            Jul 25 '17 at 20:21




            If the above notebooks don't help try googling "SimpleITK Python tutorial" and following something.
            – Dženan
            Jul 25 '17 at 20:21












            @g.stevo Your comment should be an answer, since that's what I missed in my case. All the best!
            – Бојан Матовски
            Nov 15 at 14:00




            @g.stevo Your comment should be an answer, since that's what I missed in my case. All the best!
            – Бојан Матовски
            Nov 15 at 14:00












            up vote
            0
            down vote













            MHD Files typically require an mhd header and a raw file that contains the image data - do you have both in the same directory with the mhd header pointing to the data?






            share|improve this answer

























              up vote
              0
              down vote













              MHD Files typically require an mhd header and a raw file that contains the image data - do you have both in the same directory with the mhd header pointing to the data?






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                MHD Files typically require an mhd header and a raw file that contains the image data - do you have both in the same directory with the mhd header pointing to the data?






                share|improve this answer












                MHD Files typically require an mhd header and a raw file that contains the image data - do you have both in the same directory with the mhd header pointing to the data?







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 19 at 0:37









                g.stevo

                40728




                40728






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f45289142%2ferror-reading-mhd-files-with-simpleitk-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







                    Popular posts from this blog

                    "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                    Alcedinidae

                    Origin of the phrase “under your belt”?