[Insight-developers] PointSet always assumes 3-D points??

Lydia Ng lng@insightful.com
Thu, 12 Apr 2001 12:03:07 -0700


This is a multi-part message in MIME format.

------=_NextPart_000_0003_01C0C348.899CF340
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi Parag,

I have previously had a go at using PointSet.
PointSet can take points of any dimension.
The actual template parameters are PointSet<PixelType,MeshTraits>.
It is through the MeshTraits you set the point dimension.

For example, if you wanted 4D points then you need to do
something like this:

  enum{ SpaceDimension = 4 };
  typedef int PixelType;
  typedef itk::DefaultStaticMeshTraits< PixelType, SpaceDimension >
MeshTraits;
  typedef itk::PointSet< PixelType, MeshTraits > PointSet;

I have attached a sample program.

Hope this helps,
Lydia


> -----Original Message-----
> From: insight-developers-admin@public.kitware.com
> [mailto:insight-developers-admin@public.kitware.com]On Behalf
> Of Miller,
> James V (CRD)
> Sent: Thursday, April 12, 2001 6:01 AM
> To: 'Parag Chandra'; insight-Developers
> Subject: RE: [Insight-developers] PointSet always assumes 3-D points??
>
>
> Parag,
>
> I entered this into GNATS and assigned it to Will. Thanks for
> reporting this to the list but things
> like this should also be submitted into GNATS.
>
> http://public.kitware.com/cgi-bin/gnatsweb.pl?database=insight
> <http://public.kitware.com/cgi-bin/gnatsweb.pl?database=insight>
>
> Jim
>
> -----Original Message-----
> From: Parag Chandra [mailto:chandra@cs.unc.edu]
> Sent: Wednesday, April 11, 2001 5:06 PM
> To: insight-Developers
> Subject: [Insight-developers] PointSet always assumes 3-D points??
>
>
> Hi,
> I'm trying to use the PointSet class in my programs, and it
> seems that SetPoint() always adds 3-D
> points to the set. If I declare a PointSet of 2-D points, like this:
>
> typedef Point<double, 2> PointType;
> PointSet<PointType> mySet;
>
> and then try to fill it with 2-D points, when I later print
> out the PointSet, I get output of this
> sort:
>
> 140.515  131.943  -4.22017e+037 <-- the last column is garbage
>
> Similary, if I do the same with a PointSet of 4-D points, I
> get output like this:
>
> 140.515  131.943  12 <-- the 4th column is truncated
>
> I don't think the problem is in the output method either,
> because when I try something like this:
>
> typedef EBSTransform2DType::PointType PointType2D;
> PointType2D sourcePoint2D;
> ebs2D->Getp()->SetPoint(pointNumber, sourcePoint2D);
>
> VC++ complains that it "cannot convert parameter 2 from
> itk::Point<double,2> to itk::Point<float,
> 3>".
>
> Any ideas?
>
> Thanks,
> -Parag
>
>
>
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>

------=_NextPart_000_0003_01C0C348.899CF340
Content-Type: application/octet-stream;
	name="itkMyTest.cxx"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="itkMyTest.cxx"


#include "itkPointSet.h"


int main()
{

  enum{ SpaceDimension =3D 4 };
  typedef int PixelType;
  typedef itk::DefaultStaticMeshTraits< PixelType, SpaceDimension > =
MeshTraits;
  typedef itk::PointSet< PixelType, MeshTraits > PointSet;
  typedef PointSet::PointType PointType;

  /**
   * Define the geometric positions
   */
  PointSet::CoordRepType testPointCoords[SpaceDimension];
 =20
  /**
   * Create the point set through its object factory.
   */
  PointSet::Pointer pset =3D PointSet::New();

  /**
   * Add our test points to the mesh.
   * pset->SetPoint(pointId, point)
   * Note that the constructor for Point is public, and takes an array
   * of coordinates for the point.
   */
  for(int i=3D0; i < 20 ; ++i)
    {
      for( unsigned j =3D 0; j < SpaceDimension; j++ )
       {
        testPointCoords[j] =3D (PointSet::CoordRepType) i * 10 + j;
        }
       pset->SetPoint(i, PointType(testPointCoords));
    }


  /**=20
   * Print out the points
   */
  PointType point;
  for( int i =3D 0; i < 20; ++i )
    {
    pset->GetPoint(i, &point);
    std::cout << point << std::endl;
    }

  return 0;

}
------=_NextPart_000_0003_01C0C348.899CF340--