[vtkusers] [Insight-users] Insight-users Digest, Vol 70, Issue 5

Sylvain Jaume sylvain at csail.mit.edu
Tue Feb 2 10:39:05 EST 2010


你好阿尔赛斯,

(Next time you may have more luck sending your VTK questions to <
vtkusers at vtk.org>.)

To retrieve the geometry and topology information from a vtkPolyData you can
do something like this:

double pt[3];
vtkIdType npts, *pts;

int numPts = myPolyData->GetNumberOfPoints();

for (int i=0; i < numPts; i++)
{
  myPolyData->GetPoint(m,pt);
  std::cout << "point with index " << i << ": (" << pt[0] << " " << pt[1] <<
" " << pt[2] << ")" << std::endl;
}

myPolyData->GetCells()->InitTraversal();

while (myPolyData->GetCells()->GetNextCell(npts,pts))
{
  std::cout << "cell has " << npts << " points with indices:";

  for (int i=0; i < npts; i++)
  {
    std::cout << " " << pts[i];
  }

  std::cout << std::endl;
}

You might need to try and compile this code as I have just typed it into
GMail without compiling.

Regards,
Sylvain


2010/2/2 阿尔赛斯 <wu.yichao2727 at gmail.com>

> Hello:
>
> I have a question to ask. How can I read the Triangle information(include triangle vertices,points,size of points, etc) in vtkPolyData or in vtkCellArray,because I want to build the model by my code rather than vtkOBJExporter.
>
>
> ------------------ Original ------------------
> *From:* "insight-users-request"<insight-users-request at itk.org>;
> *Date:* 2010年2月2日(星期二) 下午4:10
> *To:* "insight-users"<insight-users at itk.org>;
> *Subject:* Insight-users Digest, Vol 70, Issue 5
>
>  Send Insight-users mailing list submissions to
>     insight-users at itk.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>     http://www.itk.org/mailman/listinfo/insight-users
> or, via email, send a message with subject or body 'help' to
>     insight-users-request at itk.org
>
> You can reach the person managing the list at
>     insight-users-owner at itk.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Insight-users digest..."
>
>
> Today's Topics:
>
>    1. Re: typedef name cannot follow class/struct/union
>       (Neil.Burdett at csiro.au)
>    2. Re: typedef name cannot follow class/struct/union (Bill Lorensen)
>    3. Re: typedef name cannot follow class/struct/union (Andreas Schuh)
>    4. Re: Question about CMake_CXX_Compiler (Yang, Jinzhong)
>    5. Parametric vs. Non-parametric image registration? (motes motes)
>    6. Re: Parametric vs. Non-parametric image registration?
>       (Lodron, Gerald)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 2 Feb 2010 15:20:30 +1100
> From: <Neil.Burdett at csiro.au>
> Subject: Re: [Insight-users] typedef name cannot follow
>     class/struct/union
> To: <bill.lorensen at gmail.com>, <dan.muel at gmail.com>
> Cc: insight-users at itk.org
> Message-ID:
>     <6FACAC4CD9615D41B1FE8171A60CB98AB25DE6C297 at EXNSW-MBX03.nexus.csiro.au
> >
>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Bill and Dan,
>         thanks for the reply, but removing typename, or replacing it with
> ITK_TYPENAME gives exactly the same error in visual studio 2008;
>
> "error C2242: typedef name cannot follow class/struct/union"
>
> The full extract of code I'm using is;
>
>   // Compute the seed image, by closing cavities and holes with an ultimate
> skeleton of the cuboid image
>   typedef typename itk::UltimateSkeletonImageFilter<TOutputImage,
> TOutputImage, itk::Connectivity<Dimension, 0>, DistanceImageType >
> SeedSkeletonFilterType;
>   itk::UltimateSkeletonImageFilter<TOutputImage, TOutputImage,
> itk::Connectivity<Dimension, 0>, DistanceImageType > SeedSkeletonFilterType;
>
>   typename SeedSkeletonFilterType::Pointer seedSkeletonFilter =
> SeedSkeletonFilterType::New();
>   seedSkeletonFilter->SetInput(cuboidImage->GetOutput());
>
> seedSkeletonFilter->SetPriorityImage(distanceInvertIntensityFilter->GetOutput());
>   seedSkeletonFilter->SetInhibitImage(parallelSkeletonFilter->GetOutput());
>   try{
>     seedSkeletonFilter->Update();
>   } catch(itk::ExceptionObject &ex) {
>     throw itk::ExceptionObject("milxTopologicalHolesFilling", 0,
> std::string("Topological holes filling.. seed ultimate skeleton failed: ") +
> ex.GetDescription());
>   }
>
> Neil
>
> -----Original Message-----
> From: Bill Lorensen [mailto:bill.lorensen at gmail.com]
> Sent: Monday, 1 February 2010 11:46 PM
> To: Burdett, Neil (ICT Centre, Herston - RBWH)
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] typedef name cannot follow class/struct/union
>
> I think the typename can be removed on both Windows and linux. My
> general rule for typename is that it is required if there are no
> template variables.
>
> For example
>
> typedef Foo<bar> FooBarType;
>
> typedef typename Foo::Pointer FooPointer;
>
> On Sun, Jan 31, 2010 at 11:39 PM,  <Neil.Burdett at csiro.au> wrote:
> > Hi,
> >
> > ??? I am currently porting an application from Ubuntu to windows. The
> line
> > of code below compiles on Ubuntu but not on visual studio...
> >
> >
> >
> > ? typedef typename itk::UltimateSkeletonImageFilter<TOutputImage,
> > TOutputImage, itk::Connectivity<Dimension, 0>, DistanceImageType >
> > SeedSkeletonFilterType;
> >
> >
> >
> > I receive the error in visual studio 2008 "error C2242: typedef name
> cannot
> > follow class/struct/union"
> >
> >
> >
> > Any help would be appreciated.
> >
> >
> >
> > Neil
> >
> > _____________________________________
> > 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
> >
> >
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 1 Feb 2010 23:46:37 -0500
> From: Bill Lorensen <bill.lorensen at gmail.com>
> Subject: Re: [Insight-users] typedef name cannot follow
>     class/struct/union
> To: Neil.Burdett at csiro.au
> Cc: insight-users at itk.org
> Message-ID:
>     <4db4735c1002012046g253b8d02t7fc86b3387885728 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Delete this line:
>  itk::UltimateSkeletonImageFilter<TOutputImage, TOutputImage,
> itk::Connectivity<Dimension, 0>, DistanceImageType >
> SeedSkeletonFilterType;
>
>
> On Mon, Feb 1, 2010 at 11:20 PM,  <Neil.Burdett at csiro.au> wrote:
> > Hi Bill and Dan,
> > ? ? ? ?thanks for the reply, but removing typename, or replacing it with
> ITK_TYPENAME gives exactly the same error in visual studio 2008;
> >
> > "error C2242: typedef name cannot follow class/struct/union"
> >
> > The full extract of code I'm using is;
> >
> > ?// Compute the seed image, by closing cavities and holes with an
> ultimate skeleton of the cuboid image
> > ?typedef typename itk::UltimateSkeletonImageFilter<TOutputImage,
> TOutputImage, itk::Connectivity<Dimension, 0>, DistanceImageType >
> SeedSkeletonFilterType;
> > ?itk::UltimateSkeletonImageFilter<TOutputImage, TOutputImage,
> itk::Connectivity<Dimension, 0>, DistanceImageType > SeedSkeletonFilterType;
> >
> > ?typename SeedSkeletonFilterType::Pointer seedSkeletonFilter =
> SeedSkeletonFilterType::New();
> > ?seedSkeletonFilter->SetInput(cuboidImage->GetOutput());
> >
> ?seedSkeletonFilter->SetPriorityImage(distanceInvertIntensityFilter->GetOutput());
> >
> ?seedSkeletonFilter->SetInhibitImage(parallelSkeletonFilter->GetOutput());
> > ?try{
> > ? ?seedSkeletonFilter->Update();
> > ?} catch(itk::ExceptionObject &ex) {
> > ? ?throw itk::ExceptionObject("milxTopologicalHolesFilling", 0,
> std::string("Topological holes filling.. seed ultimate skeleton failed: ") +
> ex.GetDescription());
> > ?}
> >
> > Neil
> >
> > -----Original Message-----
> > From: Bill Lorensen [mailto:bill.lorensen at gmail.com]
> > Sent: Monday, 1 February 2010 11:46 PM
> > To: Burdett, Neil (ICT Centre, Herston - RBWH)
> > Cc: insight-users at itk.org
> > Subject: Re: [Insight-users] typedef name cannot follow
> class/struct/union
> >
> > I think the typename can be removed on both Windows and linux. My
> > general rule for typename is that it is required if there are no
> > template variables.
> >
> > For example
> >
> > typedef Foo<bar> FooBarType;
> >
> > typedef typename Foo::Pointer FooPointer;
> >
> > On Sun, Jan 31, 2010 at 11:39 PM, ?<Neil.Burdett at csiro.au> wrote:
> >> Hi,
> >>
> >> ??? I am currently porting an application from Ubuntu to windows. The
> line
> >> of code below compiles on Ubuntu but not on visual studio...
> >>
> >>
> >>
> >> ? typedef typename itk::UltimateSkeletonImageFilter<TOutputImage,
> >> TOutputImage, itk::Connectivity<Dimension, 0>, DistanceImageType >
> >> SeedSkeletonFilterType;
> >>
> >>
> >>
> >> I receive the error in visual studio 2008 "error C2242: typedef name
> cannot
> >> follow class/struct/union"
> >>
> >>
> >>
> >> Any help would be appreciated.
> >>
> >>
> >>
> >> Neil
> >>
> >> _____________________________________
> >> 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
> >>
> >>
> >
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 1 Feb 2010 23:48:31 -0500
> From: Andreas Schuh <andreas.schuh.84 at googlemail.com>
> Subject: Re: [Insight-users] typedef name cannot follow
>     class/struct/union
> To: <Neil.Burdett at csiro.au>
> Cc: itk <insight-users at itk.org>
> Message-ID: <363946BB-F10E-4E8C-8967-6E88304BE93D at googlemail.com>
> Content-Type: text/plain; charset=us-ascii
>
> Hi Neil,
>
> Try
>
> typedef  itk::UltimateSkeletonImageFilter<TOutputImage, TOutputImage,
> itk::Connectivity<Dimension, 0>, DistanceImageType > SeedSkeletonFilterType;
>
> There is no typename specified necessary here. Actually, I think it's wrong
> to use it.
>
> The second line after this one in your mail might just be a copy-and-paste
> relict while you were composing the mail. Because it doesn't make sense at
> all ...
>
> The use of the second typename for the pointer type declaration is fine and
> for compilers like the VC6 also necessary.
>
> Andreas
>
>
> On Feb 1, 2010, at 11:20 PM, <Neil.Burdett at csiro.au> wrote:
>
> > Hi Bill and Dan,
> >        thanks for the reply, but removing typename, or replacing it with
> ITK_TYPENAME gives exactly the same error in visual studio 2008;
> >
> > "error C2242: typedef name cannot follow class/struct/union"
> >
> > The full extract of code I'm using is;
> >
> >  // Compute the seed image, by closing cavities and holes with an
> ultimate skeleton of the cuboid image
> >  typedef typename itk::UltimateSkeletonImageFilter<TOutputImage,
> TOutputImage, itk::Connectivity<Dimension, 0>, DistanceImageType >
> SeedSkeletonFilterType;
> >  itk::UltimateSkeletonImageFilter<TOutputImage, TOutputImage,
> itk::Connectivity<Dimension, 0>, DistanceImageType > SeedSkeletonFilterType;
> >
> >  typename SeedSkeletonFilterType::Pointer seedSkeletonFilter =
> SeedSkeletonFilterType::New();
> >  seedSkeletonFilter->SetInput(cuboidImage->GetOutput());
> >
> seedSkeletonFilter->SetPriorityImage(distanceInvertIntensityFilter->GetOutput());
> >
> seedSkeletonFilter->SetInhibitImage(parallelSkeletonFilter->GetOutput());
> >  try{
> >    seedSkeletonFilter->Update();
> >  } catch(itk::ExceptionObject &ex) {
> >    throw itk::ExceptionObject("milxTopologicalHolesFilling", 0,
> std::string("Topological holes filling.. seed ultimate skeleton failed: ") +
> ex.GetDescription());
> >  }
> >
> > Neil
> >
> > -----Original Message-----
> > From: Bill Lorensen [mailto:bill.lorensen at gmail.com]
> > Sent: Monday, 1 February 2010 11:46 PM
> > To: Burdett, Neil (ICT Centre, Herston - RBWH)
> > Cc: insight-users at itk.org
> > Subject: Re: [Insight-users] typedef name cannot follow
> class/struct/union
> >
> > I think the typename can be removed on both Windows and linux. My
> > general rule for typename is that it is required if there are no
> > template variables.
> >
> > For example
> >
> > typedef Foo<bar> FooBarType;
> >
> > typedef typename Foo::Pointer FooPointer;
> >
> > On Sun, Jan 31, 2010 at 11:39 PM,  <Neil.Burdett at csiro.au> wrote:
> >> Hi,
> >>
> >>     I am currently porting an application from Ubuntu to windows. The
> line
> >> of code below compiles on Ubuntu but not on visual studio...
> >>
> >>
> >>
> >>   typedef typename itk::UltimateSkeletonImageFilter<TOutputImage,
> >> TOutputImage, itk::Connectivity<Dimension, 0>, DistanceImageType >
> >> SeedSkeletonFilterType;
> >>
> >>
> >>
> >> I receive the error in visual studio 2008 "error C2242: typedef name
> cannot
> >> follow class/struct/union"
> >>
> >>
> >>
> >> Any help would be appreciated.
> >>
> >>
> >>
> >> Neil
> >>
> >> _____________________________________
> >> 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
> >>
> >>
> > _____________________________________
> > 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
>
>
>
> ------------------------------
>
> Message: 4
> Date: Mon, 1 Feb 2010 23:52:39 -0600
> From: "Yang, Jinzhong" <jinzhong76 at gmail.com>
> Subject: Re: [Insight-users] Question about CMake_CXX_Compiler
> To: "'John Drescher'" <drescherjm at gmail.com>
> Cc: 'Insight Users Mailing List' <insight-users at itk.org>
> Message-ID: <011b01caa3cb$ee9b6390$cbd22ab0$@com>
> Content-Type: text/plain;    charset="ISO-8859-1"
>
> Hi John,
>
> Thank you very much for your message. I will upgrade my CMake to the new
> version.
>
> -Jinzhong
>
>
> -----Original Message-----
> From: John Drescher [mailto:drescherjm at gmail.com]
> Sent: Monday, February 01, 2010 7:03 PM
> To: Yang, Jinzhong
> Cc: Insight Users Mailing List
> Subject: Re: [Insight-users] Question about CMake_CXX_Compiler
>
> > I have a question regarding the compiler used for CMake-generated?
> projects.
> > Previously my computer is installed with MS Visual Studio 2005 only and I
> > compiled ITK using VS2005. Recently I installed the MS Visual Studio 6 on
> my
> > computer and the problem comes up. I generate my projects that require
> ITK
> > using CMake 2.6.4. The projects are configured to be MS Visual Studio
> 2005
> > projects. Each time when I configure a project in CMake GUI, I will get a
> > warning message:
> >
> > Warning: CMake is forcing CMAKE_CXX_COMPILER to "cl" to match that
> >
> > imported from ITK.? This is required because C++ projects must use the
> >
> > same compiler.? If this message appears for more than one imported
> >
> > project, you have conflicting C++ compilers and will have to re-build
> >
> > one of those projects. Was set to C:/Program Files/Microsoft
> >
> > Visual Studio/VC98/bin/cl.exe
> >
> > I checked the parameters in CMake GUI and found these parameters are
> > associated with tools coming with Visual Studio 6:
> >
> > CMAKE_CXX_COMPILER (forced to be cl during configuration)
> >
> > CMAKE_C_COMPILER
> >
> > CMAKE_LINKER
> >
> > CMAKE_RC_COMPILER
> >
> > However, the generated projects are in the VS2005 format and I can
> compile
> > them in VS2005 IDE without any problem. Here are my questions:
> >
> > 1.????? Is there any way to suppress the warning message? Specifically, I
> > would like the 4 parameters listed above associated with tools coming
> with
> > Visual Studio 2005 if the project is configured as a VS2005 project.
> >
> > 2.????? Are there any potential problems if I disregard the warning
> message?
> >
> You can disregard the message.
>
> I reported a bug about 6 months ago about this. I was told that even
> though cmake was reporting this warning it was doing the right thing
> and not using vc6. I have since upgraded to cmake-2.8.0 and I do not
> remember having this anymore.
>
> John
>
>
>
> ------------------------------
>
> Message: 5
> Date: Tue, 2 Feb 2010 09:14:09 +0100
> From: motes motes <mort.motes at gmail.com>
> Subject: [Insight-users] Parametric vs. Non-parametric image
>     registration?
> To: Insight Users Mailing List <insight-users at itk.org>
> Message-ID:
>     <54eca6a71002020014qf9e74f4idd4bbe4815938acb at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> The terms Parametric and Non-parametric Image registration are used in
> many articles but what is the exact difference?
>
> I know that optimizing a deformation field using eg. B-Splines is
> called parametric (the coefficients/parameters of the deformation
> vectors are optimized).
>
> But what are equivalent examples of non-parametric methods?
>
>
> ------------------------------
>
> Message: 6
> Date: Tue, 2 Feb 2010 09:21:36 +0100
> From: "Lodron, Gerald" <Gerald.Lodron at joanneum.at>
> Subject: Re: [Insight-users] Parametric vs. Non-parametric image
>     registration?
> To: motes motes <mort.motes at gmail.com>
> Cc: "insight-users at itk.org" <insight-users at itk.org>
> Message-ID:
>     <E70FE8EA6EBE9241BDB4CA6D8D12E1D8777D1CF352 at RZJC1EX.jr1.local>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
>
> Parametric means that you can model the transformation via a formula which
> is only dependend on a few parameters, e.g.
>
> f(x,y) = (x',y') = (x,y) + (tx, ty)
>
> Here the parameters of that "translation transform" are tx and ty.
>
>
> Nonparametric means that the transformation cannot be represented by such
> an formular, you need an explicit deformation vector for EVERY pixel. That
> is for an 2D MxN image a MxNx2 deformation field. It should be clear that a
> parametric transaformation is much easier to invert and smaller to save.
>
>
>
> -----Urspr?ngliche Nachricht-----
> Von: insight-users-bounces at itk.org [mailto:insight-users-bounces at itk.org]
> Im Auftrag von motes motes
> Gesendet: Dienstag, 02. Februar 2010 09:14
> An: Insight Users Mailing List
> Betreff: [Insight-users] Parametric vs. Non-parametric image registration?
>
> The terms Parametric and Non-parametric Image registration are used in many
> articles but what is the exact difference?
>
> I know that optimizing a deformation field using eg. B-Splines is called
> parametric (the coefficients/parameters of the deformation vectors are
> optimized).
>
> But what are equivalent examples of non-parametric methods?
> _____________________________________
> 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
>
>
> ------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
> End of Insight-users Digest, Vol 70, Issue 5
> ********************************************
>
>
> _____________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100202/eb60d35a/attachment.htm>


More information about the vtkusers mailing list