- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# C:/AngioLocalizeNoAuto/MevisLabNoAutoReg/STUMevisApp/Angiolocalize/Sources/ML/STUChamferMatching/mlChamferMatching.h

Go to the documentation of this file.

    00001 /* Copyright (c) 2009 Stanford University, School of Medicine All rights reserved.
    00002 *
    00003 * STANFORD ACADEMIC SOFTWARE LICENSE AGREEMENT
    00004 * FOR AngioLocalize SOURCE CODE:
    00005 *
    00006 * 1.  This is a legal agreement between you, RECIPIENT, and STANFORD UNIVERSITY.
    00007 *       By accepting, receiving, and using AngioLocalize.including any accompanying information, materials or
    00008 *       manuals (Program), you are agreeing to be bound by the terms of this Agreement.
    00009 *       If you do not agree to the terms of this Agreement, promptly return the Program to the STANFORD.
    00010
    00011 * 2.  STANFORD grants to RECIPIENT a royalty-free, nonexclusive, and nontransferable license to use the Program
    00012 *       and accompanying source code furnished hereunder, upon the terms and conditions set out below.
    00013 *       documentation and/or other materials provided with the distribution.
    00014 * 3.  RECIPIENT acknowledges that the Program is a research tool still in the development stage and that
    00015 *       it is being supplied as is, without any accompanying services, support or improvements from STANFORD.
    00016 * 4.  RECIPIENT agrees to use the Program solely for internal non-commercial purposes.
    00017 * 5.  RECIPIENT may create derivatives and further transfer the Program under the following terms and conditions:
    00018 *        A) Recipient agrees to not commercially exploit the Program and agrees all uses will be for non-commercial purposes; and,
    00019 *        B) Recipient may not mark any derivatives with the title of Program and may not to use iPad mark for any derivatives; and,
    00020 *        C) Recipient agrees to mark and acknowledge all derivatives as follows: "This is a derivative work based on AngioLocalize:
    00021 *           Frameless AVM localization with 2D Digital Subtraction Angiography (DSA) and 3D Rotational Angiography (DRA) Images developed
    00022 *           by Dimitre Hristov, Lina Liu.
    00023 *        D) Recipient agrees to make all improvements, enhancements and derivatives available under
    00024 *           similar terms and conditions to the research community.
    00025 * 6.   RECIPIENT warrants that RECIPIENT will not remove or export any part of the software or Program from the United
    00026 *       States except in full compliance with all United States and other applicable laws and regulations.
    00027 * 7.  RECIPIENT will use the Program in compliance with all applicable laws, policies and regulations including, but not
    00028 *       limited to, any approvals, informed consent and patient confidentiality principles.
    00029 * 8.   RECIPIENT will indemnify, hold harmless, and defend Stanford against any claim of any kind arising out of or
    00030 *       related to the exercise of any rights granted under this Agreement or the breach of this Agreement by RECIPIENT.
    00031 * 9.  Title and copyright to the Program and any associated documentation shall at all times remain with STANFORD,
    00032 *       and RECIPIENT agrees to preserve same.
    00033 */
    00034
    00035 //----------------------------------------------------------------------------------
    00037
    00044 //----------------------------------------------------------------------------------
    00045
    00046
    00047 #ifndef __mlChamferMatching_H
    00048 #define __mlChamferMatching_H
    00049
    00050
    00051 // Local includes
    00052 #include "STUChamferMatchingSystem.h"
    00053
    00054 // ML includes
    00055 #include "mlOperatorIncludes.h"
    00056 #include "mlXMarkerList.h"
    00057 #include "mlRotation.h"
    00058
    00059 #include "nr3.h"
    00060 #include "amoeha.h"
    00061 #include "amebsa.h"
    00062 ML_START_NAMESPACE
    00063
    00064
    00066 class STUCHAMFERMATCHING_EXPORT ChamferMatching : public BaseOp
    00067 {
    00068 public:
    00069
    00071   ChamferMatching ();
    00072   ~ChamferMatching ()       {if (_outMarkerList) delete _outMarkerList;
    00073                                                         if (_filteredMarkerList) delete _filteredMarkerList;}
    00074
    00076   enum {
    00077           amoeba = 0,
    00078           amebsa = 1,
    00079           numAlgorithms
    00080   };
    00081
    00083   inline MatrixField        &getMatrix1Fld () const { return *_matrix1Fld;}
    00084   inline MatrixField        &getMatrix2Fld () const { return *_matrix2Fld;}
    00085   inline MatrixField        &getMatrix3Fld () const { return *_matrix3Fld;}
    00086
    00087   inline BoolField          &getApply1Fld () const { return *_apply1Fld;}
    00088   inline BoolField          &getApply2Fld () const { return *_apply2Fld;}
    00089   inline BoolField          &getApply3Fld () const { return *_apply3Fld;}
    00090
    00091   inline NotifyField        &getStartFld () const { return *_startFld;}
    00092   inline NotifyField        &getStopFld () const { return *_stopFld;}
    00093   inline NotifyField        &getContinueFld () const { return *_continueFld;}
    00094
    00095   inline IntField           &getIterationsFld () const { return *_iterationsFld;}
    00096   inline IntField           &getUpdateFreqFld () const { return *_updateFreqFld;}
    00097   inline IntField                       &getnumMarkersFld () const {return *_numMarkersFld;}
    00098
    00099   inline FloatField         &getAccuracyFld () const { return *_accuracyFld;}
    00100   inline FloatField         &gettemperatureFld () const { return *_temperatureFld;}
    00101   inline FloatField         &getannealingFld () const { return *_annealingFld;}
    00102   inline FloatField         &getfinalCostFld () const { return *_finalCostFld;}
    00103
    00105   inline EnumField          *getModeFld()          const { return _modeFld; }
    00106
    00107   void                      updateMatrix1Fld ();
    00108   void                      updateMatrix2Fld ();
    00109   void                      updateMatrix3Fld ();
    00110
    00111
    00113   virtual void              handleNotification (Field *field);
    00114
    00116   virtual void              activateAttachments ();
    00117   void                      doTransform();
    00118   XMarkerList               *getOutMarkerList()  {return _outMarkerList;}
    00119   void                      generateMatrices(NRvector<Doub> x);
    00120   bool                      getVoxelValue(MLint OutIndex, XMarker  *marker, PagedImg *inImg, double ** voxelValue);
    00121   void                      filter();
    00122   void                      getValuesFromUI();
    00123
    00124   friend double             cost(VecDoub &x, void *obj);
    00125
    00127   virtual INPUT_HANDLE handleInput(int inIndex, INPUT_STATE state) const;
    00128
    00129 private:
    00130
    00131  //----------------------------------------------------------------------------------
    00133  //----------------------------------------------------------------------------------
    00134   //void                  test();
    00135
    00138   int         _elementNum;
    00139   const static int   _NUM_PROJECTION_PARAMETERS = 2; //assuming that the focal length is fixed, 3 otherwise
    00140   const static int   _NUM_AFFINE_PARAMETERS= 6;   //only rigid body transformations
    00141   const static int   _DEL = 5; // this is del acording to the numerical recipies.
    00142
    00144   BaseField   *_inMarkerListFld;
    00145   XMarkerList *_inMarkerList;
    00146   XMarkerList *_outMarkerList;
    00147   XMarkerList *_filteredMarkerList;
    00148
    00149   MatrixField *_matrix1Fld;
    00150   MatrixField *_matrix2Fld;
    00151   MatrixField *_matrix3Fld;
    00152
    00153   BoolField   *_apply1Fld;
    00154   BoolField   *_apply2Fld;
    00155   BoolField   *_apply3Fld;
    00156
    00157   NotifyField   *_startFld;
    00158   NotifyField   *_stopFld;
    00159   NotifyField   *_continueFld;
    00160
    00162   IntField    *_updateFreqFld;
    00163   IntField    *_iterationsFld;
    00164   IntField        *_numMarkersFld;
    00165   FloatField  *_accuracyFld;
    00166   FloatField  *_temperatureFld;
    00167   FloatField  *_annealingFld;
    00168   FloatField  *_finalCostFld;
    00169
    00170
    00172   mat4        _affine1TempM;
    00173   mat4        _perspectTempM;
    00174   mat4        _matrixToUse; //combined affine and perspective transformation
    00175   mat4        _affine2TempM;
    00176
    00177   bool        _hasMaskImage;
    00178
    00180   SubImg      _inputImage;
    00181   PagedImg    *_input1Img;
    00182   PagedImg    *_maskImg;
    00183
    00184   EnumField   *_modeFld;
    00185
    00186   int          _updateFreq;
    00187   int          _iterations;
    00188   float        _accuracy;
    00189   float            _temperature;
    00190   float            _annealing;
    00191   float            _finalCost;
    00193   ML_BASEOP_CLASS_HEADER(ChamferMatching)
    00194 };
    00195
    00196
    00197 ML_END_NAMESPACE
    00198
    00199 #endif // __mlChamferMatching_H
    00200

All Classes Namespaces Files Functions Variables Enumerator Friends