# How to read file in MedicalDemo1

**URL:** https://discourse.vtk.org/t/how-to-read-file-in-medicaldemo1/7735
**Category:** Support
**Created:** [January 29, 2022, 6:06am UTC](https://discourse.vtk.org/t/how-to-read-file-in-medicaldemo1/7735 "2022-01-29T06:06:11Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![perphy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/958977/32.png) [@perphy](https://discourse.vtk.org/u/perphy)
#### Post date: [January 29, 2022, 6:06am UTC](https://discourse.vtk.org/t/how-to-read-file-in-medicaldemo1/7735/1 "2022-01-29T06:06:11Z")

</div>

Hi,  
I am a new guy in vtk.  
I am trying to run vtk example in textbook MedicalDemo1.  
I do not know hot to load the source file - FullHead - into the program.  
I see the format of FullHead is plain text.  
I noticed that in the argparse method, the format is mhd.

Would you tell me how to run MedicalDemo1?

Thanks

 ![argparse](https://discourse.vtk.org/uploads/default/original/2X/7/7bfa5564c1ccd70d34ccaf5bfb5e4c13aa22f9ca.png)  
 ![Fullhead](https://discourse.vtk.org/uploads/default/original/2X/a/aec5290567fb55db77089820ff7ff87eec083650.png)

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [January 30, 2022, 7:55am UTC](https://discourse.vtk.org/t/how-to-read-file-in-medicaldemo1/7735/2 "2022-01-30T07:55:29Z")

</div>

You can find the data here: [https://gitlab.kitware.com/vtk/vtk-examples/-/tree/master/src/Testing/Data](https://gitlab.kitware.com/vtk/vtk-examples/-/tree/master/src/Testing/Data)

If you have downoaded the vtk-examples it will be in src/Testing/Data

---

<div class="post-metadata">

### Author: ![perphy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/958977/32.png) [@perphy](https://discourse.vtk.org/u/perphy)
#### Post date: [April 10, 2022, 9:43am UTC](https://discourse.vtk.org/t/how-to-read-file-in-medicaldemo1/7735/3 "2022-04-10T09:43:41Z")

</div>

Hi:

I have the same question.

I think what we need to know is how to run the program.  
I already downloaded the data.

Thanks very much!

---

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [April 10, 2022, 1:53pm UTC](https://discourse.vtk.org/t/how-to-read-file-in-medicaldemo1/7735/4 "2022-04-10T13:53:44Z")

</div>

The `argparse` in code means you need to input `filename` in the command line. It means you need to run this code by input `python MedicalDemo1.py filename` in the command line. You can have a try.

---

<div class="post-metadata">

### Author: ![perphy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/958977/32.png) [@perphy](https://discourse.vtk.org/u/perphy)
#### Post date: [April 11, 2022, 12:29am UTC](https://discourse.vtk.org/t/how-to-read-file-in-medicaldemo1/7735/5 "2022-04-11T00:29:50Z")

</div>

Hi, Zhang Qiang:

Thanks for responding.

I tried hard coded the filename as below.

![filename.PNG](https://discourse.vtk.org/uploads/default/original/2X/1/18e1404f46581f923fa591ecc0a32d6d8f281288.png)

But none of them worked.

 ![Error.PNG](https://discourse.vtk.org/uploads/default/original/2X/a/a370b6fbb1f21e6f52cbf05f391230724be950cd.png)

I have no idea now.

What is the correct file name for vtkMetaImageReader?

Thanks!

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [April 11, 2022, 12:49am UTC](https://discourse.vtk.org/t/how-to-read-file-in-medicaldemo1/7735/6 "2022-04-11T00:49:46Z")

</div>

If you look at the info section here: [MedicalDemo1](https://kitware.github.io/vtk-examples/site/Python/Medical/MedicalDemo1/) the file you need is **`FullHead.mhd`** it also expects **`FullHead.raw.gz`** to be in the same folder.

---

<div class="post-metadata">

### Author: ![perphy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/958977/32.png) [@perphy](https://discourse.vtk.org/u/perphy)
#### Post date: [April 11, 2022, 1:52am UTC](https://discourse.vtk.org/t/how-to-read-file-in-medicaldemo1/7735/7 "2022-04-11T01:52:58Z")

</div>

Thanks, I get it!
