[Insight-users] forget the last question

#ZHAO ZHEEN# kurtzhao at pmail.ntu.edu.sg
Fri, 9 Jan 2004 16:35:15 +0800


Hi, sorry, I know what's wrong.
it is nothing with ITK. just forget it.

Best Regards
Kurt

-----Original Message-----
From: insight-users-admin at itk.org [mailto:insight-users-admin at itk.org]On
Behalf Of #ZHAO ZHEEN#
Sent: 2004=C4=EA1=D4=C29=C8=D5 16:25
To: insight-users at itk.org
Subject: [Insight-users] how to pass a mesh out of a funcion?


Hi, there,

I created a mesh in a function, then pass the pointer out. When I was =
using the pointer outside of the function, it had been destroyed.=20
How can I use the mesh at the outside of the function?
Here is the code:

bool SegToMash(const char * SegImgFileName, float OrganValue, MeshType * =
mesh)
{
	typedef unsigned short SegPixelType;
	typedef itk::Image< SegPixelType, Dimension >   SegType;
	typedef itk::BinaryMask3DMeshSource< MeshType >  MeshSourceType;
	typedef itk::ImageFileReader< SegType >  SegReaderType;
=09
	SegReaderType::Pointer    SegReader     =3D  SegReaderType::New();
	SegReader->SetFileName(  SegImgFileName );
	 SegReader->Update();
  =20
MeshSourceType::Pointer meshSource =3D MeshSourceType::New();
=20
  meshSource->SetBinaryImage( SegReader->GetOutput() );
  meshSource->SetObjectValue( (SegPixelType)OrganValue );
  meshSource->Update();
		=20

  mesh=3DmeshSource->GetOutput();
=09
	return false;
}

Best Regards
Kurt
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users