template<class ImageType>
typename ImageType::Pointer GetImage(TagType tag, bool reload=false);
template<class ImageType>
- void SetImage(TagType tag,
- std::string f,
- typename ImageType::Pointer image,
- bool write=false);
+ void SetImage(TagType tag, std::string f, typename ImageType::Pointer image, bool write=false);
template<class ImageType>
void ReleaseImage(TagType tag);
std::string m_Filename;
typedef itk::ImageBase<3> ImageBaseType;
typedef std::map<TagType, std::string> MapTagType;
- typedef std::map<TagType, ImageBaseType*> MapTagImageType;
+ typedef std::map<TagType, ImageBaseType*> MapTagImageType;
MapTagType m_MapOfTag;
MapTagImageType m_MapOfImage;
{
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<ImageType>(image, f);
}