[Insight-users] read mhd file
zhao yong qiang
zhao-yq@cs.sjtu.edu.cn
Mon, 31 Mar 2003 11:14:26 +0800
This is a multi-part message in MIME format.
------=_NextPart_000_0001_01C2F776.B0C35C70
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Hi Luis,
I write the following code to read a series DICOM files and save it
as VTK file.
typedef itk::Image<signed int, 3> ImageType;
typedef itk::ImageFileReader< ImageType > VolumeReaderType;
VolumeReaderType::Pointer reader = VolumeReaderType::New();
reader->SetFileName( "f:\\test\\test.mhd" );
reader->Update();
ImageType::Pointer imOut;
imOut = reader->GetOutput();
itk::VTKImageIO::Pointer vtkIO;
vtkIO = itk::VTKImageIO::New();
itk::ImageFileWriter<ImageType>::Pointer writer;
writer = itk::ImageFileWriter<ImageType>::New();
writer->SetInput(imOut);
writer->SetFileName("f:\\test.vtk");
writer->Update();
writer->SetImageIO(vtkIO);
writer->Write();
But when execution, It shows:
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 154288
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
MetaImage: M_ReadElements: data not read completely
ideal = 262144 : actual = 0
Why it can not read the total data?
It seems that only read one file, others are not read.
The test.mhd file:
NDims = 3
DimSize = 256 256 18
ElementSpacing = 1 1 1
Position = 0 0 0
ElementByteOrderMSB = False
ElementType = MET_INT
HeaderSize = -1
ElementDataFile = LIST 2
00013E9A_01.dcm
00013E9A_02.dcm
00013E9A_03.dcm
00013E9A_04.dcm
00013E9A_05.dcm
00013E9A_06.dcm
00013E9A_07.dcm
00013E9A_08.dcm
00013E9A_09.dcm
00013E9A_10.dcm
00013E9A_11.dcm
00013E9A_12.dcm
00013E9A_13.dcm
00013E9A_14.dcm
00013E9A_15.dcm
00013E9A_16.dcm
00013E9A_17.dcm
00013E9A_18.dcm
Sincerely,
Zhao Yongqiang
Dept. of Computer Science & Engineering
Shanghai JiaoTong University
Shanghai, China
zhao-yq@cs.sjtu.edu.cn
------=_NextPart_000_0001_01C2F776.B0C35C70
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.emailstyle17
{font-family:Arial;
color:windowtext;}
span.emailstyle18
{font-family:Arial;}
span.emailstyle19
{font-family:Arial;}
span.EmailStyle20
{font-family:Arial;}
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
layout-grid:15.6pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=3DZH-CN link=3Dblue vlink=3Dpurple =
style=3D'text-justify-trim:punctuation'>
<div class=3DSection1 style=3D'layout-grid:15.6pt'>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>Hi Luis,</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> I write the following code =
to read
a series DICOM files and save it as VTK file.</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> typedef itk::Image<signed int, 3>
ImageType;</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> typedef itk::ImageFileReader< =
ImageType >
VolumeReaderType;</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> VolumeReaderType::Pointer reader =3D
VolumeReaderType::New();</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> reader->SetFileName( =
"f:\\test\\test.mhd"
);</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> reader->Update();</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ImageType::Pointer =
imOut;</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> imOut =3D =
reader->GetOutput();</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> itk::VTKImageIO::Pointer =
vtkIO;</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> vtkIO =3D =
itk::VTKImageIO::New();</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>
itk::ImageFileWriter<ImageType>::Pointer writer;</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> writer =3D
itk::ImageFileWriter<ImageType>::New();</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> =
writer->SetInput(imOut);</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>
writer->SetFileName("f:\\test.vtk"); =
</span></font></p>
<p class=3DMsoNormal style=3D'text-indent:18.0pt'><font size=3D1 =
face=3DArial><span
lang=3DEN-US =
style=3D'font-size:9.0pt;font-family:Arial'>writer->Update();</span></=
font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> =
writer->SetImageIO(vtkIO);</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> =
writer->Write();</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> But when execution, It =
shows:</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
154288</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>MetaImage: M_ReadElements: data not read =
completely</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'> ideal =3D 262144 : actual =3D =
0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>Why it can not read the total =
data?</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>It seems that only read one file, others are =
not read.
</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>The test.mhd file:</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>NDims =3D 3</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>DimSize =3D 256 256 18</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>ElementSpacing =3D 1 1 1</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>Position =3D 0 0 0</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>ElementByteOrderMSB =3D False</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>ElementType =3D MET_INT</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>HeaderSize =3D -1</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>ElementDataFile =3D LIST 2</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_01.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_02.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_03.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_04.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_05.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_06.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_07.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_08.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_09.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_10.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_11.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_12.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_13.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_14.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_15.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_16.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_17.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D1 face=3DArial><span lang=3DEN-US =
style=3D'font-size:
9.0pt;font-family:Arial'>00013E9A_18.dcm</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3D"Times New Roman"><span =
lang=3DEN-US
style=3D'font-size:10.0pt'>Sincerely, <br>
&=
nbsp; &n=
bsp;
Zhao Yongqiang<br>
&=
nbsp; &n=
bsp;
Dept. of Computer Science & Engineering<br>
&=
nbsp; &n=
bsp;
Shanghai JiaoTong University<br>
&=
nbsp; &n=
bsp;
Shanghai, China<br>
&=
nbsp; &n=
bsp;
<a =
href=3D"mailto:zhao-yq@cs.sjtu.edu.cn">zhao-yq@cs.sjtu.edu.cn</a></span><=
/font></p>
<p class=3DMsoNormal><font size=3D2 face=3D"Times New Roman"><span =
lang=3DEN-US
style=3D'font-size:10.0pt'> </span></font></p>
</div>
</body>
</html>
------=_NextPart_000_0001_01C2F776.B0C35C70--