X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkAnatomicalFeatureDatabase.txx;h=72e9dcdd06b9293742aa70dac935eb9d58ff4421;hb=fb01ed73088a1440263acba4cad589b15e180eef;hp=c155d44084c2581a6940e03069fee49f7bc9de03;hpb=1d616cc7be31f7195c8bba4142e02350cd2fb958;p=clitk.git diff --git a/segmentation/clitkAnatomicalFeatureDatabase.txx b/segmentation/clitkAnatomicalFeatureDatabase.txx index c155d44..72e9dcd 100644 --- a/segmentation/clitkAnatomicalFeatureDatabase.txx +++ b/segmentation/clitkAnatomicalFeatureDatabase.txx @@ -47,6 +47,39 @@ GetImage(std::string tag, bool reload) //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +template +bool AnatomicalFeatureDatabase:: +CheckImage(std::string tag) +{ + if (m_MapOfTag.find(tag) == m_MapOfTag.end()) { + return false; + } + else { + typename ImageType::Pointer image; + if (m_MapOfImage[tag]) { + image = static_cast(m_MapOfImage[tag]); + } + else { + std::string s = m_MapOfTag[tag]; + // Read the file + std::string n = GetPath()+"/"+s; + // image = readImage(); + typedef itk::ImageFileReader ReaderType; + typename ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(n.c_str()); + try { + reader->Update(); + } catch(itk::ExceptionObject & err) { + return false; + } + } + } + return true; +} +//-------------------------------------------------------------------- + + //-------------------------------------------------------------------- template void AnatomicalFeatureDatabase::