Une mise-à-jour est prévue le 9 juillet entre 13:00 et 14:00. Le service sera inaccessible ou instable pendant cette période. Merci de votre compréhension.

lsgrmFullLambdaScheduleSegmenter.txx 1.21 KB
Newer Older
1 2 3
#ifndef __LSGRM_FLS_SEGMENTER_TXX
#define __LSGRM_FLS_SEGMENTER_TXX
#include "lsgrmFullLambdaScheduleSegmenter.h"
4 5 6
namespace lsgrm
{

remicres's avatar
remicres committed
7 8 9 10 11 12 13 14
template<class TImage>
void
FullLambdaScheduleSegmenter<TImage>::WriteSpecificAttributes(NodePointerType node, FILE * nodeStream)
{
  std::size_t bands = node->m_Means.size();
  fwrite(&(bands), sizeof(bands), 1, nodeStream);

  for(unsigned int b = 0; b < node->m_Means.size(); b++)
15
    {
remicres's avatar
remicres committed
16
    fwrite(&(node->m_Means[b]), sizeof(node->m_Means[b]), 1, nodeStream);
17
    }
remicres's avatar
remicres committed
18 19 20 21 22 23 24 25 26
}

template<class TImage>
void
FullLambdaScheduleSegmenter<TImage>::ReadSpecificAttributes(NodePointerType node, FILE * nodeStream)
{
  std::size_t bands;
  fread(&(bands), sizeof(bands), 1, nodeStream);
  node->m_Means.assign(bands, 0);
27

remicres's avatar
remicres committed
28
  for(unsigned int b = 0; b < bands; b++)
29
    {
remicres's avatar
remicres committed
30 31 32 33 34 35
    fread(&(node->m_Means[b]), sizeof(node->m_Means[b]), 1, nodeStream);
    }
}

template<class TImage>
long long unsigned int
36
FullLambdaScheduleSegmenter<TImage>::GetSpecificAttributesMemory(NodePointerType &node)
remicres's avatar
remicres committed
37
{
38
  long long unsigned int memory = 0;
39

40 41
  memory += node->m_Means.size() * sizeof(float); // vector values
  memory += sizeof(std::vector<float>);           // vector container
42

remicres's avatar
remicres committed
43 44
  return memory;
}
45 46 47
} // end of namespace lsrm

#endif