- const unsigned long nb_value = GetDimensions(0)*GetDimensions(1);
- std::stringstream stream;
- stream << "######################" << endl;
- stream << "# Matrix Size= (" << GetSpacing(0)*GetDimensions(0) << "," << GetSpacing(1)*GetDimensions(1) << ",1)" << endl;
- stream << "# Resol = (" << GetDimensions(0) << "," << GetDimensions(1) << ",1)" << endl;
- stream << "# VoxelSize = (" << GetSpacing(0) << "," << GetSpacing(1) << ",1)" << endl;
- stream << "# nbVal = " << nb_value << endl;
- stream << "######################" << endl;
-
+ const unsigned long nb_value = GetDimensions(0)*GetDimensions(1);
+ std::stringstream stream;
+ stream << "######################" << endl;
+ stream << "# Matrix Size= (" << GetSpacing(0)*GetDimensions(0) << "," << GetSpacing(1)*GetDimensions(1) << ",1)" << endl;
+ stream << "# Resol = (" << GetDimensions(0) << "," << GetDimensions(1) << ",1)" << endl;
+ stream << "# VoxelSize = (" << GetSpacing(0) << "," << GetSpacing(1) << ",1)" << endl;
+ stream << "# nbVal = " << nb_value << endl;
+ stream << "######################" << endl;
+
+ if(this->GetComponentType()==itk::ImageIOBase::UCHAR) {
+ const unsigned char* buffer = static_cast<const unsigned char*>(abstract_buffer);
+ for (unsigned long kk=0; kk<nb_value; kk++)
+ stream << buffer[kk] << endl;
+ } else if(this->GetComponentType()==itk::ImageIOBase::CHAR) {
+ const char* buffer = static_cast<const char*>(abstract_buffer);
+ for (unsigned long kk=0; kk<nb_value; kk++)
+ stream << buffer[kk] << endl;
+ } else if(this->GetComponentType()==itk::ImageIOBase::USHORT) {
+ const unsigned short* buffer = static_cast<const unsigned short*>(abstract_buffer);
+ for (unsigned long kk=0; kk<nb_value; kk++)
+ stream << buffer[kk] << endl;
+ } else if(this->GetComponentType()==itk::ImageIOBase::SHORT) {
+ const short* buffer = static_cast<const short*>(abstract_buffer);
+ for (unsigned long kk=0; kk<nb_value; kk++)
+ stream << buffer[kk] << endl;
+ } else if(this->GetComponentType()==itk::ImageIOBase::UINT) {
+ const unsigned int* buffer = static_cast<const unsigned int*>(abstract_buffer);
+ for (unsigned long kk=0; kk<nb_value; kk++)
+ stream << buffer[kk] << endl;
+ } else if(this->GetComponentType()==itk::ImageIOBase::INT) {
+ const int* buffer = static_cast<const int*>(abstract_buffer);
+ for (unsigned long kk=0; kk<nb_value; kk++)
+ stream << buffer[kk] << endl;
+ } else if(this->GetComponentType()==itk::ImageIOBase::ULONG) {
+ const unsigned long* buffer = static_cast<const unsigned long*>(abstract_buffer);
+ for (unsigned long kk=0; kk<nb_value; kk++)
+ stream << buffer[kk] << endl;
+ } else if(this->GetComponentType()==itk::ImageIOBase::LONG) {
+ const long* buffer = static_cast<const long*>(abstract_buffer);
+ for (unsigned long kk=0; kk<nb_value; kk++)
+ stream << buffer[kk] << endl;
+ } else if(this->GetComponentType()==itk::ImageIOBase::FLOAT) {
+ const float* buffer = static_cast<const float*>(abstract_buffer);
+ for (unsigned long kk=0; kk<nb_value; kk++)
+ stream << buffer[kk] << endl;
+ } else if(this->GetComponentType()==itk::ImageIOBase::DOUBLE) {