[ITK] [ITK-users] Segfault in Wiki Example: QuadEdgeMeshParameterizationFilter

Arnaud Gelas arnaudgelas at gmail.com
Mon Jun 8 05:43:20 EDT 2015


Hi Davis,

The QuadEdgeMeshParameterizationFilter is a fixed boundary parameterization and requires one input mesh with at least one boundary, it could not work with a sphere…

I have updated the documentation in this patch:

	http://review.source.kitware.com/#/c/19888/ <http://review.source.kitware.com/#/c/19888/>

and added an exception in this one:

	http://review.source.kitware.com/#/c/19890/ <http://review.source.kitware.com/#/c/19890/>

Thanks for reporting!

Best,
Arnaud

> On 05 Jun 2015, at 17:09, DVigneault <davis.vigneault at gmail.com> wrote:
> 
> All--
> 
> While running the QuadEdgeMesh Parameterization example from the wiki [1]
> using the provided spherical mesh, I got a segfault on
> itkBorderQuadEdgeMeshFilter.hxx:75:
> 
> InputIteratorGeom it = bdryEdge->BeginGeomLnext();
> 
> The options I used were ./program sphere.vtk 0 0 output.vtk
> 
> After some investigation, I believe it may be that sphere.vtk has no
> internal edges.  Therefore, BorderQuadEdgeMeshFilter::Evaluate is returning
> an empty std::list, and list->Begin() is eventually dereferenced on the
> above line.  Should an itkWarningMacro() or itkExceptionMacro() be placed
> before the above line, checking whether the list is empty?  Or should this
> be on the user?
> 
> [1]
> http://www.itk.org/Wiki/ITK/Examples/Meshes/QuadEdgeMeshParameterizationFilter
> 
> One other thing that's a bit confusing--if I pass ./program sphere.vtk 1 0
> output.vtk (using DISK_BORDER_TRANSFORM instead of SQUARE_BORDER_TRANSFORM),
> there is no segfault in the wiki example.  In the small program below,
> however, it segfaults in either case.
> 
> Here's a program that describes the problem:
> 
> #include "itkRegularSphereMeshSource.h"
> #include "itkBorderQuadEdgeMeshFilter.h"
> 
> typedef itk::QuadEdgeMesh< double, 3 >                TMesh;
> typedef itk::RegularSphereMeshSource< TMesh > TSource;
> typedef itk::QuadEdgeMeshBoundaryEdgesMeshFunction< TMesh > TBorderFunction;
> typedef itk::BorderQuadEdgeMeshFilter< TMesh, TMesh > TBorder;
> int main( int argc, char* argv[] )
> {
> 
>  TSource::Pointer source = TSource::New();
>  source->Update();
>  TMesh::Pointer mesh = source->GetOutput();
> 
>  TBorderFunction::Pointer fn = TBorderFunction::New();
>  TMesh::EdgeListPointerType list = fn->Evaluate( *(mesh) );
>  std::cout << list->size() << std::endl; // 0
>  // A sphere has no internal edges
>  // Returns a std::list size zero
> 
>  TBorder::Pointer border = TBorder::New();
>  border->SetTransformType( TBorder::SQUARE_BORDER_TRANSFORM );
>  // Segfaults even if I change this to DISK_BORDER_TRANSFORM
>  border->SetInput( mesh );
>  border->Update(); // Segfault
>  // itkBorderQuadEdgeMeshFilter.hxx:110
>  // empty std::list is assigned to oborder_it
>  // for loop is bypassed b/c list->begin() == list->end()
>  // InputQEType* output = *oborder_it;
>  // return output; from ComputeLongestBorder
>  // InputQEType *bdryEdge = ComputeLongestBorder();
> 
>  // Segfault:
>  // itkBoarderQuadEdgeMeshFilter.hxx:75
>  // InputIteratorGeom it = bdryEdge->BeginGeomLnext();
> 
>  return EXIT_SUCCESS;
> 
> }
> 
> 
> 
> 
> --
> View this message in context: http://itk-users.7.n7.nabble.com/Segfault-in-Wiki-Example-QuadEdgeMeshParameterizationFilter-tp35771.html
> Sent from the ITK - Users mailing list archive at Nabble.com.
> _____________________________________
> 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.php
> 
> 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://public.kitware.com/mailman/listinfo/insight-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150608/3f36b31f/attachment.html>
-------------- next part --------------
_____________________________________
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.php

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://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list