<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Hello Luis,<br><br> Thank you for your reply. My image is 256 x 256 x 32. I have 512Mb ram. No computer does not seem to swapping memory.<br>I used .mha file instead of .vtk for the deformation field and it was quick and correct.<br><br>So, does the warper not accept .vtk files ? I tried to debug the code to see where the program takes forever and it seemed to be in the ImageFilereader (deformation field type)<br><br>The imageReader should expect a certain byte size and I am sure there are that many bytes in the file, so I'm not sure what the problem is.<br><br>Emma<br><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From:
Luis Ibanez <luis.ibanez@kitware.com><br>To: Emma Ryan <eryanvtk@yahoo.com><br>Cc: insight-users@itk.org<br>Sent: Saturday, February 23, 2008 8:00:34 PM<br>Subject: Re: [Insight-users] Is it silly to attempt this ?<br><br>
<br><br>Hi
Emma,<br><br>The
source
code
that
you
posted
seems
to
be
reasonable.<br><br><br>However,
a
duration
of
2
hours
for
warping
an
image<br>sounds
like
an
excesive
time.<br><br><br>1)
How
big
is
your
image
?<br>
pixels
along
X<br>
pixels
along
Y<br>
pixels
along
Z<br><br><br>2)
How
much
RAM
do
you
have
?<br><br><br>3)
Have
you
checked
if
your
computer<br>
is
not
swapping
memory
?<br><br>
(you
can
check
this
on
Windows
by
looking<br>
at
the
Task
Manager,
or
in
Linux
by
using<br>
the
top
tool,
or
the
system
information
tool.)<br><br><br>Please
let
us
know,<br><br><br>
Thanks<br><br><br>
Luis<br><br><br>----------------<br>Emma
Ryan
wrote:<br>>
Hi,<br>> <br>>
I
am
trying
to
read
in
a
3D
deformationField.vtk
file
and
apply
it
to <br>>
a
3D
image.
To
read
the
deformation
field,
I
use
ImageFileReader <br>>
<deformafieldType>
and
then
connect
the
output
of
this
to
the
warper.<br>> <br>>
The
code
for
this
is
available
below.
It
seems
to
take
forever
to
read <br>>
the
deformation
field
file.
Even
after
2
hours,
the
reading
is
not <br>>
complete.
What
is
going
on
?
Any
clues
?<br>> <br>>
Thanks,<br>>
Emma<br>> <br>> <br>>
#if
defined(_MSC_VER)<br>>
#pragma
warning
(
disable
:
4786
)<br>>
#endif<br>> <br>>
#include
"itkImageFileReader.h"<br>>
#include
"itkImageFileWriter.h"<br>> <br>>
#include
"itkImageRegionIterator.h"<br>> <br>> <br>>
#include
"itkCastImageFilter.h"<br>>
#include
"itkWarpImageFilter.h"<br>>
#include
"itkLinearInterpolateImageFunction.h"<br>> <br>>
#include
"itkSquaredDifferenceImageFilter.h"<br>>
#include
"itkCheckerBoardImageFilter.h"<br>>
#include
"itkTimeProbe.h"
<br>> <br>>
#include
"itkImageRegionIteratorWithIndex.h"<br>>
#include
"itkPointSet.h"<br>>
#include
<fstream><br>> <br>> <br>> <br>>
int
main(
int
argc,
char
*argv[]
)<br>>
{<br>>
if(
argc
<
4
)<br>>
{<br>>
std::cerr
<<
"Missing
Parameters
"
<<
std::endl;<br>>
std::cerr
<<
"Usage:
"
<<
argv[0];<br>>
std::cerr
<<
"
fixedImagefile
movingImageFile
deformField.vtk
";<br>>
std::cerr
<<
"
outputImageFile
"
<<
std::endl;<br>>
return
1;<br>>
}<br>> <br>>
<br>>
const
unsigned
int
Dimension
=
3;<br>>
typedef
unsigned
char
PixelType;<br>> <br>> <br>>
typedef
itk::Image<
PixelType,
Dimension
>
FixedImageType;<br>>
typedef
itk::ImageFileReader<
FixedImageType
>
FixedImageReaderType;<br>>
FixedImageReaderType::Pointer
fixedImageReader
= <br>>
FixedImageReaderType::New();<br>>
fixedImageReader->SetFileName(
argv[1]
);<br>> <br>>
<br>>
typedef
itk::Image<
PixelType,
Dimension
>
MovingImageType;<br>>
typedef
itk::ImageFileReader<
MovingImageType
>
MovingImageReaderType;<br>>
MovingImageReaderType::Pointer
movingImageReader
= <br>>
MovingImageReaderType::New();<br>>
movingImageReader->SetFileName(
argv[2]
);<br>> <br>>
typedef
itk::Vector<
float,
Dimension
>
VectorPixelType;<br>>
typedef
itk::Image<
VectorPixelType,
Dimension
>
DeformationFieldType;<br>> <br>>
typedef
itk::ImageFileReader<
DeformationFieldType
>
FieldReaderType;<br>>
FieldReaderType::Pointer
fieldReader
=
FieldReaderType::New();<br>> <br>>
fieldReader->SetFileName(
argv[3]
);<br>> <br>>
<br>>
try
{<br>> <br>>
fieldReader->Update();<br>>
}<br>> <br>>
catch
(
itk::ExceptionObject
&
err
)<br>>
{<br>>
std::cerr
<<
"ExceptionObject
caught
!"
<<
std::endl;<br>>
std::cerr
<<
err
<<
std::endl;<br>>
return
-1;<br>>
}<br>> <br>> <br>>
<br>>
typedef
itk::WarpImageFilter<MovingImageType, <br>>
MovingImageType,DeformationFieldType
>
WarperType;<br>>
typedef
itk::LinearInterpolateImageFunction<MovingImageType,
double <br>>
>
InterpolatorType;<br>>
WarperType::Pointer
warper
=
WarperType::New();<br>>
InterpolatorType::Pointer
interpolator
=
InterpolatorType::New();<br>>
FixedImageType::Pointer
fixedImage
=
fixedImageReader->GetOutput();<br>> <br>>
<br>>
warper->SetInput(
movingImageReader->GetOutput()
);<br>>
warper->SetInterpolator(
interpolator
);<br>>
warper->SetOutputSpacing(
fixedImage->GetSpacing()
);<br>>
warper->SetOutputOrigin(
fixedImage->GetOrigin()
);<br>> <br>>
warper->SetDeformationField(
fieldReader->GetOutput()
);<br>> <br>> <br>>
typedef
unsigned
char
OutputPixelType;<br>>
typedef
itk::Image<
OutputPixelType,
Dimension
>
OutputImageType;<br>>
typedef
itk::CastImageFilter<<br>>
MovingImageType,<br>>
OutputImageType
>
CastFilterType;<br>>
typedef
itk::ImageFileWriter<
OutputImageType
>
WriterType;<br>> <br>> <br>>
WriterType::Pointer
writer
=
WriterType::New();<br>>
CastFilterType::Pointer
caster
=
CastFilterType::New();<br>> <br>>
writer->SetFileName(
argv[4]
);<br>> <br>>
<br>>
caster->SetInput(
warper->GetOutput()
);<br>>
writer->SetInput(
caster->GetOutput()
);<br>>
writer->Update();<br>> <br>>
<br>>
return
0;<br>>
}<br>> <br>> <br>> <br>>
------------------------------------------------------------------------<br>>
Looking
for
last
minute
shopping
deals?
Find
them
fast
with
Yahoo! <br>>
Search. <br>>
<<a href="http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping" target="_blank">http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping</a>><br>> <br>> <br>>
------------------------------------------------------------------------<br>> <br>>
_______________________________________________<br>>
Insight-users
mailing
list<br>>
<a ymailto="mailto:Insight-users@itk.org" href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br>>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br></div><br></div></div><br>
<hr size=1>Looking for last minute shopping deals? <a href="http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping">
Find them fast with Yahoo! Search.</a></body></html>