[Insight-users] Problem relate with deformablemesh3Dfilter.

Samuel Rodríguez Bescos srodrigu@gbt.tfo.upm.es
Thu, 19 Sep 2002 18:00:44 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_0044_01C26006.79C63BA0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

Hi Luis,

I'm working in Windows.

I think the critical code is the following but I post all the files. I'm
sorry if It's not totally correct, It's my first version. If you want me to
improve the aspect. Tell it to me.
----------------------------------------------------------------------------
------------------------
(....)
  m_stiff[0] = 0.00001;
  m_stiff[1] = 0.04;
  m_scale[0] = 2;
  m_scale[1] = 2;
  m_scale[2] = 2;

(...)

m_BinaryMask3DMeshSource->SetBinaryImage(m_BinaryErodeImageFilter->GetOutput
());
  m_BinaryMask3DMeshSource->SetObjectValue(255); /* I'm not sure the correct
value.
  m_BinaryMask3DMeshSource->Update();

  m_DeformableMesh3DFilter->SetStiffness(m_stiff);
  m_DeformableMesh3DFilter->SetTimeStep(0.2);
  m_DeformableMesh3DFilter->SetStepThreshold(1);
  m_DeformableMesh3DFilter->SetScale(m_scale);

  m_DeformableMesh3DFilter->SetGradient(m_GradientImageFilter->GetOutput());
  m_DeformableMesh3DFilter->SetInput(m_BinaryMask3DMeshSource->GetOutput());
  m_DeformableMesh3DFilter->Update();
........

Thanks a lot for your help:

----- Original Message -----
From: "Luis Ibanez" <luis.ibanez@kitware.com>
To: "Samuel Rodríguez Bescos" <srodrigu@gbt.tfo.upm.es>
Cc: <insight-users@public.kitware.com>
Sent: Thursday, September 19, 2002 5:31 PM
Subject: Re: [Insight-users] Problem relate with deformablemesh3Dfilter.


>
> Hi Samuel,
>
> Could you please post the full piece of code
> that you are using for your example ?
>
> If the problem is an illegal access to memory,
> it could be related with the initialization of the
> filters you are using.
>
> You may also want to put the Update() call
> in a try/catch block in case there are exceptions
> trown. Something like
>
> try
>   {
>    m_DeformableMesh3DFilter->Update( );
>   }
> catch( itk::ExceptionObject & except )
>   {
>   std::cout << except << std::endl;
>   }
>
>
>
> Are you doing this on windows or unix ?
>
>
> Thanks
>
> Luis
>
> ================================
>
> Samuel Rodríguez Bescos wrote:
>
> > Hi everybody,
> >
> >
> >
> > I'm implementing an example that uses the itkDeformableMesh3DFilter.
> > I'm using the filter itkBinaryMask3DMeshSource as its input. And  as
> > the gradient image the output of the filter itkGradientImageFilter of
> > the initial image.
> >
> > The problem is than when I run the program , there is an error
> > of access violation in the line:
> >
> >
> >
> > m_DeformableMesh3DFilter->Update( );
> >
> >
> >
> > I thought that the problem is related with the BinaryMeshSource and I
> > tried to visualizate its output but I couldn't. I think that the
> > problem is in the parameters of it.
> >
> >
> >
> > I use as input of the BinaryMeshSource a binary Image with 1 at the
> > pixels of the object and 0 at the background and I set the Object
> > Value to 1.
> >
> >
> >
> > Could anybody the poblem?. I don't know if the parameters and the
> > inputs are right or I have forgotten something.
> >
> >
> >
> > Thanks in advance,
> >
> >
> >
> > Samuel
> >
>

------=_NextPart_000_0044_01C26006.79C63BA0
Content-Type: application/octet-stream;
	name="liDeformableModelSegmentationConsole.h"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="liDeformableModelSegmentationConsole.h"

/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

  Program:   Insight Segmentation & Registration Toolkit
  Module:    $RCSfile: ceExtractorConsole.h,v $
  Language:  C++
  Date:      $Date: 2002/01/15 20:12:05 $
  Version:   $Revision: 1.8 $

  Copyright (c) 2002 Insight Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for =
details.

     This software is distributed WITHOUT ANY WARRANTY; without even=20
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR =

     PURPOSE.  See the above copyright notices for more information.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/




#ifndef li_Deformable_Model_Segmentation_Console_h
#define li_Deformable_Model_Segmentation_Console_h

#include "liDeformableModelSegmentationConsoleGUI.h"
#include "fltkDisplayGlWindowGUI.h"
#include "fltkPointSet3D.h"
#include "fltkPointSet2D.h"
#include "itkPointSet.h"
#include <fltkImageViewer.h>
#include <FL/fl_file_chooser.H>



class liDeformableModelSegmentationConsole : public =
liDeformableModelSegmentationConsoleGUI=20
{

public:

  typedef fltkDisplayGlWindowGUI                GlDisplayType;
 =20

  typedef /*Sphere*/MeshType					PointSetType;
  typedef fltk::PointSet3D< PointSetType >      PointSetShapeType;
  typedef PointSetShapeType::Pointer            PointSetShapePointer;

  typedef unsigned char											OverlayPixelType;
 =20
  typedef fltk::ImageViewer< InputPixelType,=20
                                    OverlayPixelType >          =
InputImageViewerType;

 =20

  typedef fltk::ImageViewer< BinaryMaskPixelType,=20
                                    OverlayPixelType >          =
BinaryMaskImageViewerType;



public:
  liDeformableModelSegmentationConsole();
  virtual ~liDeformableModelSegmentationConsole();
  virtual void LoadInputImage(void);
  virtual void Show(void);
  virtual void Hide(void);
 =20
  virtual void ShowParametricSpace(void);
 =20
private:

=09
  GlDisplayType					m_ParametricSpaceViewer;
 =20
  PointSetShapePointer			m_ParametricSpaceSamplesShape;

  BinaryMaskImageViewerType		m_BinaryErodeImageViewer;

  InputImageViewerType			m_InputImageViewer;
							 =20
};



#endif

------=_NextPart_000_0044_01C26006.79C63BA0
Content-Type: application/octet-stream;
	name="liDeformableModelSegmentationConsole.cxx"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="liDeformableModelSegmentationConsole.cxx"

/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

  Program:   Insight Segmentation & Registration Toolkit
  Module:    $RCSfile: ceExtractorConsole.cxx,v $
  Language:  C++
  Date:      $Date: 2002/01/15 20:12:04 $
  Version:   $Revision: 1.14 $

  Copyright (c) 2002 Insight Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for =
details.

     This software is distributed WITHOUT ANY WARRANTY; without even=20
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR =

     PURPOSE.  See the above copyright notices for more information.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/


#include "liDeformableModelSegmentationConsole.h"



/************************************
 *
 *  Constructor
 *
 ***********************************/
liDeformableModelSegmentationConsole
::liDeformableModelSegmentationConsole()
{
=20


  m_ParametricSpaceSamplesShape =3D PointSetShapeType::New();
/*
   m_ParametricSpaceSamplesShape->SetPointSet(=20
                          =
/*m_SphereSource*//*m_DeformableMesh3DFilter->GetOutput() );*/

  m_ParametricSpaceSamplesShape->SetPointSet(=20
                          m_BinaryMask3DMeshSource->GetOutput() );
						 =20

  m_InputImageViewer.SetImage(m_Reader->GetOutput());
  m_InputImageViewer.SetLabel("Input Image");

  =
m_BinaryErodeImageViewer.SetImage(m_BinaryErodeImageFilter->GetOutput());=

  m_BinaryErodeImageViewer.SetLabel("Mask Image");
 =20

 =20

}



/************************************
 *
 *  Destructor
 *
 ***********************************/
liDeformableModelSegmentationConsole
::~liDeformableModelSegmentationConsole()
{

}  =20


/************************************
 *
 *  Load Input Image
 *
 ***********************************/
void
liDeformableModelSegmentationConsole
::LoadInputImage( void )
{

  const char * filename =3D fl_file_chooser("Input Image =
filename","*.mh[da]","");
  if( !filename )
  {
    return;
  }

  //this->ShowStatus("Loading input image file...");
 =20
  try=20
  {
    liDeformableModelSegmentationConsoleBase::LoadInputImage( filename =
);
  }
  catch( ... )=20
  {
    //this->ShowStatus("Problems reading file format");
	  std::cout<<"Problems reading file format";
    return;
  }
}
/************************************
 *
 *  Show
 *
 ***********************************/
void
liDeformableModelSegmentationConsole
::Show( void )
{
  consoleWindow->show();
}



/************************************
 *
 *  Hide
 *
 ***********************************/

void
liDeformableModelSegmentationConsole
::Hide( void )
{

  m_ParametricSpaceViewer.Hide();


}



/************************************
 *
 *  Show the Parametric Space
 *
 ***********************************/
void
liDeformableModelSegmentationConsole
::ShowParametricSpace( void )
{
/*
  m_GradientRecursiveGaussianImageFilter->Update();
  m_GradientToMagnitudeImageFilter->Update();
  */

	m_Reader->Update();
	m_InputImageViewer.SetImage(m_Reader->GetOutput());
	m_InputImageViewer.Show();

=09

  m_CastImageFilter->Update();
  m_GradientImageFilter->Update();

  m_GradientAnisotropicDiffusionImageFilter->Update();
  m_ConfidenceConnectedImageFilter->Update();
 =20
  m_BinaryDilateImageFilter->Update();
  m_BinaryErodeImageFilter->Update();

  =
m_BinaryErodeImageViewer.SetImage(m_BinaryErodeImageFilter->GetOutput());=

  m_BinaryErodeImageViewer.Show();
 =20

  =
m_BinaryMask3DMeshSource->SetBinaryImage(m_BinaryErodeImageFilter->GetOut=
put());
  m_BinaryMask3DMeshSource->SetObjectValue(255);
  m_BinaryMask3DMeshSource->Update();

=20
  m_DeformableMesh3DFilter->SetStiffness(m_stiff);
		m_DeformableMesh3DFilter->SetTimeStep(0.2);
		m_DeformableMesh3DFilter->SetStepThreshold(1);
		m_DeformableMesh3DFilter->SetScale(m_scale);

  =
m_DeformableMesh3DFilter->SetGradient(m_GradientImageFilter->GetOutput())=
;
  =
m_DeformableMesh3DFilter->SetInput(m_BinaryMask3DMeshSource->GetOutput())=
;


 // m_DeformableMesh3DFilter->Update();

/*
  m_ParametricSpaceSamplesShape->SetPointSet(=20
                          =
/*m_SphereSource*//*m_DeformableMesh3DFilter->GetOutput() );*/
 =20
  m_ParametricSpaceSamplesShape->SetPointSet(=20
                          =
/*m_SphereSource*/m_BinaryMask3DMeshSource->GetOutput() );
  // OpenGL display list mode
  m_ParametricSpaceSamplesShape->SetCompileMode( =
fltk::Shape3D::compileExecute );=20

  m_ParametricSpaceViewer.SetLabel("Malla final");




  // Register the PointSet as a Drawer in the OpenGL window
 =20

  m_ParametricSpaceViewer.GetNotifier()->AddObserver(=20
                         fltk::GlDrawEvent(),=20
                         =
m_ParametricSpaceSamplesShape->GetDrawCommand().GetPointer() );

 =20
  // Notify the OpenGL window when the set of points changes
=20
/*
  m_SphereSource->AddObserver( itk::EndEvent(),
                        m_ParametricSpaceViewer.GetRedrawCommand() );
*/
/*m_DeformableMesh3DFilter->AddObserver( itk::EndEvent(),
                        m_ParametricSpaceViewer.GetRedrawCommand());
*/
m_BinaryMask3DMeshSource->AddObserver( itk::EndEvent(),
                        m_ParametricSpaceViewer.GetRedrawCommand());


  fltk::Shape3D::ColorType  parametricSpacePointsColor;
  parametricSpacePointsColor.SetRed(   1.0 );
  parametricSpacePointsColor.SetGreen( 0.0 );
  parametricSpacePointsColor.SetBlue(  0.0 );
  m_ParametricSpaceSamplesShape->SetColor( parametricSpacePointsColor );

  fltk::GlWindowInteractive::ColorType  parametricSpaceBackgroundColor;
  parametricSpaceBackgroundColor.SetRed(   0.9);
  parametricSpaceBackgroundColor.SetGreen( 0.9);
  parametricSpaceBackgroundColor.SetBlue(  0.9);
  m_ParametricSpaceViewer.GetGlWindow()->SetBackground(=20
                                           =
parametricSpaceBackgroundColor );
=20
  m_ParametricSpaceViewer.Show();
  /*this->ResetViewOfParametricSpace();*/

}



------=_NextPart_000_0044_01C26006.79C63BA0
Content-Type: application/octet-stream;
	name="liDeformableModelSegmentationConsoleBase.cxx"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="liDeformableModelSegmentationConsoleBase.cxx"

/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

  Program:   Insight Segmentation & Registration Toolkit
  Module:    $RCSfile: ceExtractorConsoleBase.cxx,v $
  Language:  C++
  Date:      $Date: 2002/01/15 20:12:05 $
  Version:   $Revision: 1.10 $

  Copyright (c) 2002 Insight Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for =
details.

     This software is distributed WITHOUT ANY WARRANTY; without even=20
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR =

     PURPOSE.  See the above copyright notices for more information.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/


#include <liDeformableModelSegmentationConsoleBase.h>
#include <itkMetaImageIOFactory.h>
#include <itkRawImageIO.h>
#include <FL/fl_ask.H>


/************************************
 *
 *  Constructor
 *
 ***********************************/
liDeformableModelSegmentationConsoleBase=20
::liDeformableModelSegmentationConsoleBase()
{




/*
m_SphereSource =3D SphereSourceType::New();

m_spherecenter[0] =3D (double) 100;
m_spherecenter[1] =3D (double) 0;
m_spherecenter[2] =3D (double) 0;
m_scale[0] =3D 100.0;
m_scale[1] =3D 100.0;
m_scale[2] =3D 100.0;

m_SphereSource->SetCenter(m_spherecenter);
m_SphereSource->SetResolutionX(100);
m_SphereSource->SetResolutionY(100);
m_SphereSource->SetSquareness1(1.0);
m_SphereSource->SetSquareness2(1.0);
m_SphereSource->SetScale(m_scale);
m_SphereSource->Update();
*/

=09
=09
	m_Reader							=3D	ImageReaderType::New();

	itk::MetaImageIOFactory::RegisterOneFactory();

	itk::RawImageIOFactory< InputImageType::PixelType, 3 =
>::RegisterOneFactory();
//	m_Io								=3D	IoType::New();


  =20



    m_CastImageFilter =3D CastImageFilterType::New();
    m_CastImageFilter->SetInput( m_Reader->GetOutput() );
=09


	m_BinaryMask3DMeshSource			=3D	BinaryMask3DMeshSourceType::New();=09
=09
	m_GradientToMagnitudeImageFilter	=3D	=
GradientToMagnitudeImageFilterType::New();

	m_GradientVectorFlowImageFilter		=3D	=
GradientVectorFlowImageFilterType::New();

	m_GradientImageFilter				=3D   GradientImageFilterType::New();

	m_GradientRecursiveGaussianImageFilter =3D =
GradientRecursiveGaussianImageFilterType::New();
		m_GradientRecursiveGaussianImageFilter->SetSigma(2.0);

	m_DeformableMesh3DFilter			=3D	DeformableMesh3DFilterType::New();
/*
	=
m_GradientRecursiveGaussianImageFilter->SetInput(m_Reader->GetOutput());
	=
m_GradientToMagnitudeImageFilter->SetInput(m_GradientRecursiveGaussianIma=
geFilter->GetOutput());
	=
m_GradientImageFilter->SetInput(m_GradientToMagnitudeImageFilter->GetOutp=
ut());
	*/
=09
	m_GradientImageFilter->SetInput(m_CastImageFilter->GetOutput());
=09
/*	m_GradientImageFilter->SetInput(m_Reader->GetOutput());*/
=09


       =20
	m_GradientAnisotropicDiffusionImageFilter	=3D	=
GradientAnisotropicDiffusionImageFilterType::New();
		m_GradientAnisotropicDiffusionImageFilter->SetTimeStep(0.125);
		m_GradientAnisotropicDiffusionImageFilter->SetIterations(1);
		m_GradientAnisotropicDiffusionImageFilter->SetConductanceParameter(3);
		=
m_GradientAnisotropicDiffusionImageFilter->SetInput(m_CastImageFilter->Ge=
tOutput());

	m_ConfidenceConnectedImageFilter	=3D	=
ConfidenceConnectedImageFilterType::New();
		=
m_ConfidenceConnectedImageFilter->SetInput(m_GradientAnisotropicDiffusion=
ImageFilter->GetOutput());
	=09
		m_Seed[0] =3D static_cast<IndexType::IndexValueType>( 127.4 );
		m_Seed[1] =3D static_cast<IndexType::IndexValueType>( 114.17 );
		m_Seed[2] =3D static_cast<IndexType::IndexValueType>( 95.00 );
		m_ConfidenceConnectedImageFilter->SetSeed( m_Seed );
		m_ConfidenceConnectedImageFilter->SetNumberOfIterations(2);
		m_ConfidenceConnectedImageFilter->SetMultiplier(1.5);



	m_BinaryErodeImageFilter			=3D	BinaryErodeImageFilterType::New();
	m_BinaryDilateImageFilter			=3D	BinaryDilateImageFilterType::New();

	KernelType::SizeType  BallSize;
	BallSize[0]=3D3;
	BallSize[1]=3D3;
	BallSize[2]=3D3;

	m_Ball.SetRadius(BallSize);
	m_Ball.CreateStructuringElement();

	=
m_BinaryDilateImageFilter->SetInput(m_ConfidenceConnectedImageFilter->Get=
Output());
	m_BinaryDilateImageFilter->SetKernel(m_Ball);
	m_BinaryDilateImageFilter->SetDilateValue(1);

	=
m_BinaryErodeImageFilter->SetInput(m_BinaryDilateImageFilter->GetOutput()=
);
	m_BinaryErodeImageFilter->SetKernel(m_Ball);
	m_BinaryErodeImageFilter->SetErodeValue(2);

	=
m_BinaryMask3DMeshSource->SetBinaryImage(m_BinaryErodeImageFilter->GetOut=
put());
	m_BinaryMask3DMeshSource->SetObjectValue(1);/* En el ejemplo pone =
255)*/

	=
m_DeformableMesh3DFilter->SetInput(m_BinaryMask3DMeshSource->GetOutput())=
;
		=
m_DeformableMesh3DFilter->SetGradient(m_GradientImageFilter->GetOutput())=
;
		m_stiff[0] =3D 0.00001;
		m_stiff[1] =3D 0.04;
		m_scale[0] =3D 2;
		m_scale[1] =3D 2;
		m_scale[2] =3D 2;
		m_DeformableMesh3DFilter->SetStiffness(m_stiff);
		m_DeformableMesh3DFilter->SetTimeStep(0.2);
		m_DeformableMesh3DFilter->SetStepThreshold(1);
		m_DeformableMesh3DFilter->SetScale(m_scale);

=09



}




/************************************
 *
 *  Destructor
 *
 ***********************************/
liDeformableModelSegmentationConsoleBase=20
::~liDeformableModelSegmentationConsoleBase()
{
	/*
	delete(m_BinaryErodeImageFilter);
	delete(m_BinaryDilateImageFilter);
	delete(m_Ball);
	delete(m_ConfidenceConnectedImageFilter);
	delete(m_GradientAnisotropicDiffusionImageFilter);
	delete(m_DeformableMesh3DFilter);
	delete(m_GradientVectorFlowImageFilter);
	delete(m_GradientToMagnitudeImageFilter);
	delete(m_BinaryMask3DMeshSource);
	delete(m_Io);
	delete(m_Reader);
	*/


}

/************************************
 *
 *  Load Input Image
 *
 ***********************************/
void
liDeformableModelSegmentationConsoleBase=20
::LoadInputImage( const char * filename )
{
  if( !filename )
  {
    return;
  }

  m_Reader->SetFileName( filename );
  //m_Reader->SetImageIO(m_Io);
  m_Reader->Update();
 =20
 =20
}

=20



=20


=20





=20




=20



=20


=20

------=_NextPart_000_0044_01C26006.79C63BA0
Content-Type: application/octet-stream;
	name="liDeformableModelSegmentationConsoleBase.h"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="liDeformableModelSegmentationConsoleBase.h"

/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

  Program:   Insight Segmentation & Registration Toolkit
  Module:    $RCSfile: ceExtractorConsoleBase.h,v $
  Language:  C++
  Date:      $Date: 2002/01/15 20:12:06 $
  Version:   $Revision: 1.12 $

  Copyright (c) 2002 Insight Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for =
details.

     This software is distributed WITHOUT ANY WARRANTY; without even=20
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR =

     PURPOSE.  See the above copyright notices for more information.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/




#ifndef li_Deformable_Model_Segmentation_Console_Base_h
#define li_Deformable_Model_Segmentation_Console_Base_h


#include "itkMesh.h"
#include "itkImage.h"

#include "itkSphereSource.h"
#include "itkDeformableMesh3DFilter.h"
#include "itkBinaryMask3DMeshSource.h"

#include "itkGradientVectorFlowImageFilter.h"
#include "itkCovariantVector.h"
#include "itkGradientRecursiveGaussianImageFilter.h"
#include "itkGradientToMagnitudeImageFilter.h"
#include "itkGradientImageFilter.h"

#include "itkImageFileReader.h"
#include "itkRawImageIO.h"
#include <itkMetaImageIO.h>

#include <itkGradientAnisotropicDiffusionImageFilter.h>
#include <itkConfidenceConnectedImageFilter.h>
#include <itkBinaryDilateImageFilter.h>
#include <itkBinaryErodeImageFilter.h>
#include <itkBinaryBallStructuringElement.h>

#include <itkCastImageFilter.h>





class liDeformableModelSegmentationConsoleBase=20
{

public:


  typedef   unsigned char								InputPixelType;
  typedef   float										PixelType;
  typedef   double										MeshDataType;
  typedef   itk::CovariantVector<double,3>				GradientImagePixelType;
  typedef   unsigned short								BinaryMaskPixelType;
 =20
 =20
  typedef   itk::Image<InputPixelType,3>				InputImageType;
  typedef   itk::Image<PixelType,3>						ImageType;
  typedef   itk::Image<GradientImagePixelType,3>		GradientImageType;

  typedef	itk::CovariantVector<double,2>				Double2DVector;
  typedef	itk::CovariantVector<double,3>				Double3DVector;

  typedef	itk::Image<BinaryMaskPixelType,3>			BinaryMaskImageType;


  typedef   itk::Mesh<MeshDataType>						MeshType;

  /*
  typedef   MeshType::Pointer				    SphereMeshPointerType;
  typedef   itk::SphereSource<MeshType>	        SphereSourceType;
  typedef   SphereSourceType::Pointer		    SphereSourcePointerType;
  */

  /*typedef   SphereMeshType::PointType				OPointType;*/


  typedef	itk::CastImageFilter<=20
								InputImageType,=20
								ImageType >				CastImageFilterType;
							=09

  typedef	itk::DeformableMesh3DFilter<MeshType,
									 MeshType>			DeformableMesh3DFilterType;

  typedef	itk::GradientRecursiveGaussianImageFilter<
									ImageType,
									GradientImageType>	GradientRecursiveGaussianImageFilterType;

 =20
  typedef	itk::GradientVectorFlowImageFilter<=09
									GradientImageType,
									GradientImageType>  GradientVectorFlowImageFilterType;

  typedef	itk::GradientImageFilter<ImageType,
									double,
									double>				GradientImageFilterType;

  typedef	itk::GradientToMagnitudeImageFilter <
									GradientImageType,
									ImageType>			GradientToMagnitudeImageFilterType;


  /* Esta parametrizado por el tipo de datos de la malla de salida
  /* La image Binarizada que se le mete como entrada debe ser diel tipo =
Image<unsigned short,3>*/

  typedef  itk::BinaryMask3DMeshSource<MeshType>		=
BinaryMask3DMeshSourceType;


  typedef  itk::GradientAnisotropicDiffusionImageFilter<
									ImageType,=20
									ImageType >			GradientAnisotropicDiffusionImageFilterType;

  typedef   itk::ConfidenceConnectedImageFilter<=20
									ImageType,=20
									BinaryMaskImageType >			ConfidenceConnectedImageFilterType;

  typedef ConfidenceConnectedImageFilterType::IndexType IndexType;


  typedef   itk::BinaryBallStructuringElement<
									BinaryMaskPixelType,
									3>					KernelType;
 =20
  typedef	itk::BinaryErodeImageFilter<
									BinaryMaskImageType,
									BinaryMaskImageType,	=09
									KernelType>			BinaryErodeImageFilterType;

  typedef	itk::BinaryDilateImageFilter<
									BinaryMaskImageType,
									BinaryMaskImageType,
									KernelType>			BinaryDilateImageFilterType;


  typedef itk::ImageFileReader<InputImageType >		        =
ImageReaderType; //Probar con ImageType
  typedef itk::MetaImageIO							    IoType;


public:

  liDeformableModelSegmentationConsoleBase();
  virtual ~liDeformableModelSegmentationConsoleBase();
  virtual void LoadInputImage(void)=3D0;
  virtual void LoadInputImage(const char * filename);
 =20

protected:

	ImageReaderType::Pointer							m_Reader;
	IoType::Pointer										m_Io;
	CastImageFilterType::Pointer						m_CastImageFilter;
	BinaryMask3DMeshSourceType::Pointer					m_BinaryMask3DMeshSource;
	GradientToMagnitudeImageFilterType::Pointer			=
m_GradientToMagnitudeImageFilter;
	GradientVectorFlowImageFilterType::Pointer			=
m_GradientVectorFlowImageFilter;
	GradientImageFilterType::Pointer					m_GradientImageFilter;
	GradientRecursiveGaussianImageFilterType::Pointer		=
m_GradientRecursiveGaussianImageFilter;
	DeformableMesh3DFilterType::Pointer					m_DeformableMesh3DFilter;
	GradientAnisotropicDiffusionImageFilterType::Pointer		=
m_GradientAnisotropicDiffusionImageFilter;
	ConfidenceConnectedImageFilterType::Pointer				=
m_ConfidenceConnectedImageFilter;
	KernelType												m_Ball;
	BinaryErodeImageFilterType::Pointer						m_BinaryErodeImageFilter;
	BinaryDilateImageFilterType::Pointer					m_BinaryDilateImageFilter;
    Double2DVector											m_stiff;
	Double3DVector											m_scale;
=09
	IndexType												m_Seed;





/*
  SphereSourcePointerType						m_SphereSource;
  OPointType									m_spherecenter;
  OPointType									m_scale;
*/



};

#endif

------=_NextPart_000_0044_01C26006.79C63BA0
Content-Type: application/octet-stream;
	name="liDeformableModelSegmentationConsoleGUI.cxx"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="liDeformableModelSegmentationConsoleGUI.cxx"

// generated by Fast Light User Interface Designer (fluid) version =
1.0011

#include "liDeformableModelSegmentationConsoleGUI.h"

liDeformableModelSegmentationConsoleGUI::liDeformableModelSegmentationCon=
soleGUI() {
  Fl_Window* w;
  { Fl_Window* o =3D consoleWindow =3D new Fl_Window(1012, 391, =
"Deformable Model Segmentation");
    w =3D o;
    o->user_data((void*)(this));
    o->end();
  }
}

liDeformableModelSegmentationConsoleGUI::~liDeformableModelSegmentationCo=
nsoleGUI() {
}

void liDeformableModelSegmentationConsoleGUI::Quit( void ) {
}

void liDeformableModelSegmentationConsoleGUI::ShowParametricSpace( void =
) {
}

void liDeformableModelSegmentationConsoleGUI::LoadInputImage(void) {
}

------=_NextPart_000_0044_01C26006.79C63BA0
Content-Type: application/octet-stream;
	name="liDeformableModelSegmentationConsoleGUI.h"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="liDeformableModelSegmentationConsoleGUI.h"

// generated by Fast Light User Interface Designer (fluid) version =
1.0011

#ifndef liDeformableModelSegmentationConsoleGUI_h
#define liDeformableModelSegmentationConsoleGUI_h
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <liDeformableModelSegmentationConsoleBase.h>
#include <fltkLightButton.h>

class liDeformableModelSegmentationConsoleGUI : public =
liDeformableModelSegmentationConsoleBase {
public:
  liDeformableModelSegmentationConsoleGUI();
  Fl_Window *consoleWindow;
  virtual ~liDeformableModelSegmentationConsoleGUI();
  virtual void Quit( void );
  virtual void ShowParametricSpace( void );
  virtual void LoadInputImage(void);
};
#endif

------=_NextPart_000_0044_01C26006.79C63BA0
Content-Type: application/octet-stream;
	name="main.cxx"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="main.cxx"

/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

  Program:   Insight Segmentation & Registration Toolkit
  Module:    $RCSfile: main.cxx,v $
  Language:  C++
  Date:      $Date: 2002/01/15 20:12:06 $
  Version:   $Revision: 1.2 $

  Copyright (c) 2002 Insight Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for =
details.

     This software is distributed WITHOUT ANY WARRANTY; without even=20
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR =

     PURPOSE.  See the above copyright notices for more information.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
#include "liDeformableModelSegmentationConsole.h"


/**
 *
 *   Main program=20
 *
 */
int main()
{

  liDeformableModelSegmentationConsole * console =3D new =
liDeformableModelSegmentationConsole();

  console->Show();
  console->LoadInputImage();
  console->ShowParametricSpace();

  Fl::run();

  delete console;
 =20
  return 0;

}



















------=_NextPart_000_0044_01C26006.79C63BA0--