[Insight-users] itkCastImageFilter
Luis Ibanez
luis.ibanez@kitware.com
Tue, 23 Apr 2002 14:35:50 -0400
Hi Pieter,
This is strange indeed.
The cast filter is pretty simple
and works ok for ND images.
Could you please confirm is the following is a
correct description of your pipeline:
====== +-----+ ===== +-----+ ============ +----+
Reader->|Image|->Cast->|Image|->Deformable3D->|Mesh|
====== |float| ===== |short| ============ | |
+-----+ +-----+ +----+
What are the ranges of values in your float input image ?
do they fit naturaly on a short ?
Are you running this in Unix or Windows ?
From your email I couldn't quite differentiate the
two cases, could you please clarify what happens
on each of the following cases:
1) When connecting the pipeline as shown in the figure
and calling Update() in the Deformable3D filter.
2) When disconecting the Cast filter and using iterator
for copying the image to a temporary one.
On which one of these cases are you finding the nan's
in the Deformable filter ?
Thanks
Luis
===========================================================
Pieter Vos wrote:
>Hello,
>
>Somehow the itkCastImageFilter is capable of changing my deformable
>mesh. After one iteration of the deformableMesh3DFilter the Z-coordinate
>of the mesh is changed to a 'nan' (not a number)???
>How could this be?
>
>My input image is of float type which I read with a itkVTKImageIO and
>Filereader.
>
> typedef itk::Image<float, myDimension> inputImageType;
> typedef itk::Image<unsigned short, myDimension> potentialImageType;
>
>I would like to cast it to a unsigned short image, since the
>itkDeformable3DFilter demands this type for the potential image (and the
>output image) as well.
>I use a float mesh:
> typedef itk::Mesh<float> FMesh;
>And the filter
> typedef itk::DeformableMesh3DFilter<FMesh, FMesh> DFilter;
>
>The strange thing is that I did an update with the CastImageFilter:
>
> typedef itk::CastImageFilter< inputImageType, potImageType>
>myCasterType;
>
> myCasterType potCaster = myCasterType::New();
> potCaster->SetInput( potImgReader->GetOutput() );
> potCaster->Update();
>
>And did not connect the output of the cast with the input (as a test) of
>the deformable filter. In stead, I made two iterators and pasted all the
>pixels to a copy img of type potImageType (like in the example
>itkDeformable3DFilterTest, to go around the cast):
>
> itk::ImageRegionIteratorWithIndex <potImageType> ptit(potImg,
>potRegion);
> itk::ImageRegionIteratorWithIndex<inputImageType> readerit
>(potImgReader->GetOutput(), potRegion);
> ptit.Set((unsigned short) readerit.Get());
> deformablefilter->SetPotential( potImg )
>
>So what is going on? I wrote the cast to a file and it seemed ok. How can
>it be that the caster affects the deformable filter?
>May I assume that the caster works for 3D images?
>
>Many thanks for the help!
>