24 const uint8_t version = 1;
28 out << BITFIELD_BYTES;
30 this->internal_writeToStream(
out);
33 template <
unsigned int BYTES_REQUIRED_>
40 pixelLabels.resize(nR, nC);
41 for (uint32_t c = 0; c < nC; c++)
42 for (uint32_t r = 0; r < nR; r++) in >> pixelLabels.coeffRef(r, c);
44 in >> pixelLabelNames;
46 template <
unsigned int BYTES_REQUIRED_>
51 const auto nR =
static_cast<uint32_t
>(pixelLabels.rows());
52 const auto nC =
static_cast<uint32_t
>(pixelLabels.cols());
54 for (uint32_t c = 0; c < nC; c++)
55 for (uint32_t r = 0; r < nR; r++)
out << pixelLabels.coeff(r, c);
57 out << pixelLabelNames;
72 uint8_t bitfield_bytes;
78 switch (bitfield_bytes)
97 throw std::runtime_error(
98 "Unknown type of pixelLabel inner class while "
114 template <
unsigned int BYTES_REQUIRED_>
118 const auto nR =
static_cast<uint32_t
>(pixelLabels.rows());
119 const auto nC =
static_cast<uint32_t
>(pixelLabels.cols());
120 out <<
"Number of rows: " << nR <<
"\n";
121 out <<
"Number of cols: " << nC <<
"\n";
122 out <<
"Matrix of labels:\n";
123 for (uint32_t c = 0; c < nC; c++)
125 for (uint32_t r = 0; r < nR; r++)
126 out << pixelLabels.coeff(r, c) <<
" ";
132 out <<
"Label indices and names: " << std::endl;
133 std::map<uint32_t, std::string>::const_iterator it;
134 for (it = pixelLabelNames.begin(); it != pixelLabelNames.end(); it++)
135 out << it->first <<
" " << it->second << std::endl;