From: David Sarrut Date: Thu, 27 Oct 2011 13:56:40 +0000 (+0200) Subject: Add afdb_path option X-Git-Tag: v1.3.0~174^2~16 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=bd90d593f957ab1c755dcb6200a05adc8d832b79;p=clitk.git Add afdb_path option --- diff --git a/segmentation/clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx b/segmentation/clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx index bec6b9e..6db7c4b 100644 --- a/segmentation/clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx +++ b/segmentation/clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx @@ -25,6 +25,7 @@ FilterWithAnatomicalFeatureDatabaseManagement() { m_AFDB = NULL; SetAFDBFilename("default.afdb"); + SetAFDBPath("./"); } //-------------------------------------------------------------------- @@ -42,6 +43,7 @@ void clitk::FilterWithAnatomicalFeatureDatabaseManagement::WriteAFDB() void clitk::FilterWithAnatomicalFeatureDatabaseManagement::LoadAFDB() { GetAFDB()->SetFilename(GetAFDBFilename()); + GetAFDB()->SetPath(GetAFDBPath()); try { GetAFDB()->Load(); } catch (clitk::ExceptionObject e) { @@ -53,10 +55,10 @@ void clitk::FilterWithAnatomicalFeatureDatabaseManagement::LoadAFDB() //-------------------------------------------------------------------- -clitk::AnatomicalFeatureDatabase * clitk::FilterWithAnatomicalFeatureDatabaseManagement::GetAFDB() +clitk::AnatomicalFeatureDatabase::Pointer clitk::FilterWithAnatomicalFeatureDatabaseManagement::GetAFDB() { - if (m_AFDB == NULL) { - m_AFDB = new clitk::AnatomicalFeatureDatabase; + if (!m_AFDB) { + m_AFDB = clitk::AnatomicalFeatureDatabase::New(); } return m_AFDB; } diff --git a/segmentation/clitkFilterWithAnatomicalFeatureDatabaseManagement.h b/segmentation/clitkFilterWithAnatomicalFeatureDatabaseManagement.h index ca8fd98..a1f9f29 100644 --- a/segmentation/clitkFilterWithAnatomicalFeatureDatabaseManagement.h +++ b/segmentation/clitkFilterWithAnatomicalFeatureDatabaseManagement.h @@ -42,19 +42,28 @@ namespace clitk { itkTypeMacro(FilterWithAnatomicalFeatureDatabaseManagement, Object); // Set/Get filename - itkBooleanMacro(AFDBFilenameGivenFlag); - itkSetMacro(AFDBFilenameGivenFlag, bool); - itkGetConstMacro(AFDBFilenameGivenFlag, bool); - GGO_DefineOption_Flag(afdb, SetAFDBFilenameGivenFlag); + // itkBooleanMacro(AFDBFilenameGivenFlag); + // itkSetMacro(AFDBFilenameGivenFlag, bool); + // itkGetConstMacro(AFDBFilenameGivenFlag, bool); + // GGO_DefineOption_Flag(afdb, SetAFDBFilenameGivenFlag); + + // itkBooleanMacro(AFDBPathGivenFlag); + // itkSetMacro(AFDBPathGivenFlag, bool); + // itkGetConstMacro(AFDBPathGivenFlag, bool); + // GGO_DefineOption_Flag(afdb_path, SetAFDBPathGivenFlag); itkSetMacro(AFDBFilename, std::string); itkGetConstMacro(AFDBFilename, std::string); - GGO_DefineOption_WithTest(afdb, SetAFDBFilename, std::string, AFDBFilenameGivenFlag); + // GGO_DefineOption_WithTest(afdb, SetAFDBFilename, std::string, AFDBFilenameGivenFlag); + + itkSetMacro(AFDBPath, std::string); + itkGetConstMacro(AFDBPath, std::string); + // GGO_DefineOption_WithTest(afdb_path, SetAFDBPath, std::string, AFDBPathGivenFlag); void WriteAFDB(); void LoadAFDB(); - AnatomicalFeatureDatabase * GetAFDB(); + AnatomicalFeatureDatabase::Pointer GetAFDB(); void SetAFDB(AnatomicalFeatureDatabase * a) { m_AFDB = a; } protected: @@ -62,8 +71,10 @@ namespace clitk { virtual ~FilterWithAnatomicalFeatureDatabaseManagement() {} std::string m_AFDBFilename; - bool m_AFDBFilenameGivenFlag; - clitk::AnatomicalFeatureDatabase * m_AFDB; + // bool m_AFDBFilenameGivenFlag; + std::string m_AFDBPath; + // bool m_AFDBPathGivenFlag; + clitk::AnatomicalFeatureDatabase::Pointer m_AFDB; private: FilterWithAnatomicalFeatureDatabaseManagement(const Self&); //purposely not implemented