<commit_before>/*
 * Image.cpp
 *
 *  Created on: Sep 8, 2009
 *      Author: rasmussn
 */

#include "Image.hpp"

#ifdef PV_USE_MPI
   #include <mpi.h>
#endif
#include <assert.h>
#include <string.h>

namespace PV {

Image::Image() {
   initialize_base();
}

Image::Image(const char * name, HyPerCol * hc, const char * filename) {
   initialize_base();
   initialize(name, hc, filename);
}

Image::~Image() {
   free(filename);
   filename = NULL;
   Communicator::freeDatatypes(mpi_datatypes); mpi_datatypes = NULL;

   if(writePosition){
      if (getParent()->icCommunicator()->commRank()==0 && fp_pos != NULL && fp_pos != stdout) {
            fclose(fp_pos);
         }
   }
}

int Image::initialize_base() {
   mpi_datatypes = NULL;
   data = NULL;
   filename = NULL;
   imageData = NULL;
   useImageBCflag = false;
   writeImages = false;
   inverseFlag = false;
   normalizeLuminanceFlag = false;
   offsets[0] = 0;
   offsets[1] = 1;
   jitterFlag = false;
   jitterType = RANDOM_WALK;
   stepSize = 0;<commit_msg>Default for offset in y direction should be 0, not 1.<commit_after>/*
 * Image.cpp
 *
 *  Created on: Sep 8, 2009
 *      Author: rasmussn
 */

#include "Image.hpp"

#ifdef PV_USE_MPI
   #include <mpi.h>
#endif
#include <assert.h>
#include <string.h>

namespace PV {

Image::Image() {
   initialize_base();
}

Image::Image(const char * name, HyPerCol * hc, const char * filename) {
   initialize_base();
   initialize(name, hc, filename);
}

Image::~Image() {
   free(filename);
   filename = NULL;
   Communicator::freeDatatypes(mpi_datatypes); mpi_datatypes = NULL;

   if(writePosition){
      if (getParent()->icCommunicator()->commRank()==0 && fp_pos != NULL && fp_pos != stdout) {
            fclose(fp_pos);
         }
   }
}

int Image::initialize_base() {
   mpi_datatypes = NULL;
   data = NULL;
   filename = NULL;
   imageData = NULL;
   useImageBCflag = false;
   writeImages = false;
   inverseFlag = false;
   normalizeLuminanceFlag = false;
   offsets[0] = 0;
   offsets[1] = 0;
   jitterFlag = false;
   jitterType = RANDOM_WALK;
   stepSize = 0;
{'fraction_non_alphanumeric': 0.14189837008628955, 'fraction_numerical': 0.011505273250239693, 'mean_word_length': 3.294238683127572, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3701897', 'n_tokens_mistral': 780, 'n_tokens_neox': 754, 'n_words': 167}