[Insight-users] Fiter's Update(-

Georges Le Goualher georges at maunakeatech . com
Fri, 13 Jun 2003 14:17:06 +0200


--Apple-Mail-8--109985092
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed


Hi Luis,

This is the filter header. Hope this help.

Many thanks,

Georges


--Apple-Mail-8--109985092
Content-Disposition: attachment;
	filename=myfilter.h
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	x-unix-mode=0644;
	name="myfilter.h"


#ifndef __myfilterfilter_h
#define __myfilterfilter_h

#include <itkImage.h>
#include <itkImageToMeshFilter.h>

#include "fdg.h"


namespace mz
{
class MyfilterParam {
 public :
 MyfilterParam () {
   defaults();
 }
 /// Gives the default values for the parameters
 void defaults() {
  doZ       = true; 
  doD       = true; 
  hD        = 1; 
  oFactor   = 1.8; 
  oSNL = 6;
  oSRM = 1;
  agp.defaults();
 }
 /// Load parameters from a file. If any error occurs, default values are provided. 
 void loadParam(const char * fname);
 /// Save parameters in a file.
 void saveParam(const char * fname);
 /// Output stream
 friend std::ostream & operator << (std::ostream &, MyfilterParam &);
 /// Input stream
 friend std::istream & operator >> (std::istream &, MyfilterParam &);
 // Parameters list : 
 /// doZ
 bool  doZ;
 /// D
 bool  doD;
 /// hD
 int   hD; 
 /** factor 
 */
 float oFactor ;
 /// Min 
 int   oSNL ;
 /// Re
 int   oSRM ;
 /// Class
 FdMGParam agp;
};



/// My filter
/**
*/
template < class TInputImage, class TOutputMesh >
class ITK_EXPORT MyfilterFilter : public itk::ImageToMeshFilter< TInputImage, TOutputMesh > 
{
public: 
   /** Standard class typedefs. */
   typedef MyfilterFilter  Self;
   typedef itk::ImageToMeshFilter < TInputImage, TOutputMesh > Superclass;
   typedef itk::SmartPointer<Self>  Pointer;
   typedef itk::SmartPointer<const Self>  ConstPointer;

   /** Some input Image related typedefs. */
   typedef  TInputImage ImputImageType;
   typedef typename ImputImageType::PixelType PixelType;
   typedef typename ImputImageType::IndexType IndexType;

   /** Some output component image related typedefs. */
   typedef unsigned long LPixelType ;
   typedef itk::Image<LPixelType,2 > LImageType ;

 
   /** Some typedefs associated with the output mesh. */
   typedef TOutputMesh OutputMeshType;
   typedef typename OutputMeshType::PointType        PointType;
   typedef typename OutputMeshType::Pointer          OutputMeshPointer;
   typedef typename OutputMeshType::PointsContainer  PointsContainer; 
   typedef typename OutputMeshType::PointIdentifier  PointIdentifier; 
   typedef typename PointsContainer::Pointer         PointsContainerPointer;
   typedef typename PointsContainer::Iterator        PointsContainerIterator;
   typedef typename OutputMeshType::PointDataContainer PointDataContainer; 
   typedef typename PointDataContainer::Pointer      PointDataContainerPointer;
   typedef typename PointDataContainer::Iterator     PointDataContainerIterator;

   
   /** Run-time type information (and related methods). */
   itkTypeMacro(MeshToImageMoFilter , itk::MeshToImageFilter );

   /** Method for creation through the object factory.  */
   itkNewMacro(Self);

   /** SetCaImage **/
   void SetCaImage(const InputImageType *inputImg){
      SetInput (0, inputImg) ;
   }
   
   /** SetBaCaImage   **/
   void SetBaCa(const InputImageType *inputBa){
      SetInput (1, inputBa) ;
   }

   /** Get co image **/
   LImageType * GetCoImage() { return _lImg;}

   /** The main function **/
   virtual void GenerateData();
   
   /** Input requested region  **/
   virtual void GenerateInputRequestedRegion();

   

protected:
   MyfilterFilter ();
   ~MyfilterFilter  (){}
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
   // I N T E R N A L   F U N C T I O N S
   // To be used only by derived classes
   
   /** pre
   */
   void pre();
   
   /** w
    */
   void w();

   /** sB
    */
   int sB ();

   /** mS
    */
   int mS ();

   /** create output mesh
    */
   void createOuputMesh ();

   /// Get filter parameters
   MyfilterParam getParam(){
      return _fdp;
   }
   /// Set object parameters
   void setParam(MyfilterParam & fdp){
      _fdp = fdp;
   }

private:

   MyfilterFilter (const MyfilterFilter &); //purposely not implemented
   void operator=(const MyfilterFilter &); //purposely not implemented


  // Main parameters are stored in a separate class MyfilterParam
   MyfilterParam _fdp;

   typename TInputImage::Pointer _baseImg;
   typename LImageType::Pointer _lImg;

   std::vector< std::set<unsigned long> > _n;
   std::vector< int > _fS; 
   std::vector< float > _fC; 
   unsigned short _mCC; 
   float _fSM; 
   std::vector<short> _fob; 
   std::vector<float> _fiCo;
   
      
}; // of class MyfilterFilter

} // namespace mz

#ifndef ITK_MANUAL_INSTANTIATION
#include "myfilterfilter.hxx"
#endif

#endif// __myfilterfilter_h


--Apple-Mail-8--109985092
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed




On Thursday, June 12, 2003, at 03:46 PM, Luis Ibanez wrote:

>
> Hi Georges,
>
> Your understanding of the pipeline is correct.
> The GenerateData() method shouldn't be invoked
> if the input, nor the filter parameters have
> changed.
>
> Could you please give us more details on the
> way you wrote your filter ?
>
> What are the types of the inputs and outputs ?
>
> Are you using the Set/Get macros for setting
> the filter parameters ?
>
> If you post the header file of the filter,
> that could help us to figure out what's wrong.
>
>
> Thanks
>
>
>    Luis
>
>
> ------------------------------
>
> Georges Le Goualher wrote:
>> Hi all,
>> I've written an itk filter and have the following problem:
>> the GenerateData() method is called each time
>> I call the Update() method even if the entries did not changed
>> between two successive calls.
>> I understand the normal behavior for a filter is to not
>> do anything when called a second time on the same
>> inputs.
>> Can someone explain what is the code that control
>> this behaviour?
>> Thanks,
>> Georges
>> ---------------------------------------------------------------------
>> Georges Le Goualher
>> Ingenieur de Recherche / Research Engineer
>> Mauna Kea Technologies, Paris
>> www.maunakeatech.com
>> tel: 33 1 48 24 24 96
>> fax: 33 1 48 24 12 18
>> ---------------------------------------------------------------------
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at www . itk . org
>> http://www . itk . org/mailman/listinfo/insight-users
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at www . itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>
>
---------------------------------------------------------------------
Georges Le Goualher
Ingenieur de Recherche / Research Engineer
Mauna Kea Technologies, Paris
www.maunakeatech.com
tel: 33 1 48 24 24 96
fax: 33 1 48 24 12 18
---------------------------------------------------------------------

--Apple-Mail-8--109985092--