[Insight-users] a black slice by using GridImageSource
Luis Ibanez
luis.ibanez at kitware.com
Sat Feb 6 12:33:06 EST 2010
Hi Xi,
Are you sure that these intermediate
slides are completely black ?
They should contain isolated pixels that
are ON, every 8 pixels.
Note that this is a 3D grid, so when you
visit the slices in a 2D view, you will see
one slice with a 2D grid, and then, the
next slice will contain only ON pixels in
the nodes of the previous slice.
Loading the volume into ParaView and
doing a iso-contour extraction should
show you a 3D grid structurs.
You can download ParaView from
www.paraview.org
Regards,
Luis
-----------------------------------------------------
2010/1/28 Xi LIANG <liangxi1986317 at hotmail.com>:
> Dear all,
> I am trying to draw a 3D grid to show the nonrigid registration result by
> using GridImageSource. However, there is 1/8 slices in each dimension of the
> grid volume are black, I found this is related to the gridSpacing.Fill(8),
> Is there anyway to make every slice has grid with no black slices in any
> dimension at all?
> The following code are used to set the parameters.
> const unsigned int ImageDimension = 3;
> typedef double PixelType;
> typedef itk ::Image <PixelType , ImageDimension > ImageType;
> // Instantiate the filter
> typedef itk :: GridImageSource <ImageType > GridSourceType ;
> GridSourceType :: Pointer gridImage = GridSourceType :: New ();
> double scale = 255.0;
> ImageType :: SizeType size;
> ImageType :: PointType origin;
> ImageTyp e :: SpacingType spacing;
> GridSourceType :: ArrayType gridSpacing;
> GridSourceType :: ArrayType gridOffset;
> GridSourceType :: ArrayType sigma;
> GridSourceType :: BoolArrayType which;
> // Specify image parameters
> origin.Fill( 0.0 );
> size.Fill( 128 );
> spacing.Fill( 1.0 );
> // Specify grid parameters
> gridSpacing .Fill( 8.0 );
> gridOffset.Fill( 0.0 );
> sigma.Fill( 1 );
> which.Fill( true );
>
>
> // Specify 0th order B-spline function (Box function)
> typedef itk :: BSplineKernelFunction <0> KernelType;
> KernelType :: Pointer kernel = KernelType :: New ();
> // Set parameters
> gridImage -> SetKernelFunction ( kernel );
> gridImage ->SetSpacing( spacing );
> gridImage ->SetOrigin( origin );
> gridImage ->SetSize( size );
> gridImage -> SetGridSpacing ( gridSpacing );
> gridImage -> SetGridOffset ( gridOffset );
> gridImage -> SetWhichDimensions ( which );
> gridImage ->SetSigma( sigma );
> gridImage ->SetScale( scale );
> --------------------------------
> Xi Liang
>
> 梁茜
> --------------------------------
>
>
>
> ________________________________
> Hotmail: Trusted email with powerful SPAM protection. Sign up now.
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list