X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=segmentation%2FclitkAnatomicalFeatureDatabase.txx;h=1aad4f6eec882f08f2ee2964feb095b75b4258f6;hb=bf825658276640209b8eb9c3e237e49e50b93579;hp=7ec7f971ac05143d9afdf69b441f1b510c860662;hpb=bf4928c59a1d39f53fe03deb4b73ecb7e1cf214b;p=clitk.git diff --git a/segmentation/clitkAnatomicalFeatureDatabase.txx b/segmentation/clitkAnatomicalFeatureDatabase.txx index 7ec7f97..1aad4f6 100644 --- a/segmentation/clitkAnatomicalFeatureDatabase.txx +++ b/segmentation/clitkAnatomicalFeatureDatabase.txx @@ -54,6 +54,8 @@ SetImage(TagType tag, std::string f, typename ImageType::Pointer image, bool wri { SetImageFilename(tag, f); m_MapOfImage[tag] = &(*image); + // I add a reference count because the cache is not a smartpointer + image->SetReferenceCount(image->GetReferenceCount()+1); if (write) { writeImage(image, f); } @@ -71,7 +73,6 @@ ReleaseImage(std::string tag) } else { typename ImageType::Pointer image = GetImage(tag); - DD(image->GetReferenceCount()); image->SetReferenceCount(image->GetReferenceCount()-1); m_MapOfImage.erase(tag); }