<commit_before>///////////////////////////////////////////////////////////////////////////////
// MODULE:			ImgBuffer.h
// SYSTEM:        ImageBase subsystem
// AUTHOR:			<NAME>, <EMAIL>
//
// DESCRIPTION:	Basic implementation for the raw image buffer data structure.
//
// COPYRIGHT:     <NAME>, 2005. All rigths reserved.
//
// LICENSE:       This file is free for use, modification and distribution and
//                is distributed under terms specified in the BSD license
//                This file is distributed in the hope that it will be useful,
//                but WITHOUT ANY WARRANTY; without even the implied warranty
//                of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
//                IN NO EVENT SHALL THE COPYRIGHT OWNER OR
//                CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
//                INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES.
//
// NOTE:          Imported from ADVI for use in Micro-Manager
///////////////////////////////////////////////////////////////////////////////

#if !defined(_IMG_BUFFER_)
#define _IMG_BUFFER_

#include <string>
#include <vector>
#include <map>
#include "MMDevice.h"
#include "ImageMetadata.h"

///////////////////////////////////////////////////////////////////////////////
//
// CImgBuffer class
// ~~~~~~~~~~~~~~~~~~
// Variable pixel depth image buffer
//

class ImgBuffer
{
public:
   ImgBuffer(unsigned xSize, unsigned ySize, unsigned pixDepth);
   ImgBuffer(const ImgBuffer& ib);
   ImgBuffer();
   ~ImgBuffer();

   unsigned int Width() const {return width_;}
   unsigned int Height() const {return height_;}
   unsigned int Depth() const {return pixDepth_;}
   void SetPixels(const void* pixArray);
   void SetPixelsPadded(const void* pixArray, int paddingBytesPerLine);
   void ResetPixels();
   const unsigned char* GetPixels() const;
   unsigned char* GetPixelsRW();

   void Resize(unsigned xSize, unsigned ySize, unsigned pixDepth);
   void Resize(unsigned xSize, unsigned ySize);
   bool Compatible(const ImgBuffer& img) const;

   void SetName(const char* name) {name_ = name;}
   const std::string& GetName() {return name_;}
   void SetMetadata(const Metadata& md);
   const Metadata& GetMetadata() const {return metadata_;}

   void Copy(const ImgBuffer& rhs);
   ImgBuffer& operator=(const ImgBuffer& rhs);

private:
   unsigned char* pixels_;
   unsigned int width_;
   unsigned int height_;
   unsigned int pixDepth_;
   std::string name_;
   //MM::ImageMetadata metadata_;
   Metadata metadata_;
};

class FrameBuffer
{
public:
   FrameBuffer();
   FrameBuffer(unsigned xSize, unsigned ySize, unsigned byteDepth);
   ~FrameBuffer();

   void Resize(unsigned xSize, unsigned ySize, unsigned pixDepth);
   void Clear();
   void Preallocate(unsigned channels, unsigned slices);

   bool SetImage(unsigned channel, unsigned slice, const ImgBuffer& img);
   bool GetImage(unsigned channel, unsigned slice, ImgBuffer& img) const;
   ImgBuffer* FindImage(unsigned channel, unsigned slice) const;
   const unsigned char* GetPixels(unsigned channel, unsigned slice) const;
   bool SetPixels(unsigned channel, unsigned slice, const unsigned char* pixels);
   unsigned Width() const {return width_;}
   unsigned Height() const {return height_;}<commit_msg>ImgBuffer.h, removed commented out line of code<commit_after>///////////////////////////////////////////////////////////////////////////////
// MODULE:			ImgBuffer.h
// SYSTEM:        ImageBase subsystem
// AUTHOR:			<NAME>, <EMAIL>
//
// DESCRIPTION:	Basic implementation for the raw image buffer data structure.
//
// COPYRIGHT:     <NAME>, 2005. All rigths reserved.
//
// LICENSE:       This file is free for use, modification and distribution and
//                is distributed under terms specified in the BSD license
//                This file is distributed in the hope that it will be useful,
//                but WITHOUT ANY WARRANTY; without even the implied warranty
//                of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
//                IN NO EVENT SHALL THE COPYRIGHT OWNER OR
//                CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
//                INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES.
//
// NOTE:          Imported from ADVI for use in Micro-Manager
///////////////////////////////////////////////////////////////////////////////

#if !defined(_IMG_BUFFER_)
#define _IMG_BUFFER_

#include <string>
#include <vector>
#include <map>
#include "MMDevice.h"
#include "ImageMetadata.h"

///////////////////////////////////////////////////////////////////////////////
//
// CImgBuffer class
// ~~~~~~~~~~~~~~~~~~
// Variable pixel depth image buffer
//

class ImgBuffer
{
public:
   ImgBuffer(unsigned xSize, unsigned ySize, unsigned pixDepth);
   ImgBuffer(const ImgBuffer& ib);
   ImgBuffer();
   ~ImgBuffer();

   unsigned int Width() const {return width_;}
   unsigned int Height() const {return height_;}
   unsigned int Depth() const {return pixDepth_;}
   void SetPixels(const void* pixArray);
   void SetPixelsPadded(const void* pixArray, int paddingBytesPerLine);
   void ResetPixels();
   const unsigned char* GetPixels() const;
   unsigned char* GetPixelsRW();

   void Resize(unsigned xSize, unsigned ySize, unsigned pixDepth);
   void Resize(unsigned xSize, unsigned ySize);
   bool Compatible(const ImgBuffer& img) const;

   void SetName(const char* name) {name_ = name;}
   const std::string& GetName() {return name_;}
   void SetMetadata(const Metadata& md);
   const Metadata& GetMetadata() const {return metadata_;}

   void Copy(const ImgBuffer& rhs);
   ImgBuffer& operator=(const ImgBuffer& rhs);

private:
   unsigned char* pixels_;
   unsigned int width_;
   unsigned int height_;
   unsigned int pixDepth_;
   std::string name_;
   Metadata metadata_;
};

class FrameBuffer
{
public:
   FrameBuffer();
   FrameBuffer(unsigned xSize, unsigned ySize, unsigned byteDepth);
   ~FrameBuffer();

   void Resize(unsigned xSize, unsigned ySize, unsigned pixDepth);
   void Clear();
   void Preallocate(unsigned channels, unsigned slices);

   bool SetImage(unsigned channel, unsigned slice, const ImgBuffer& img);
   bool GetImage(unsigned channel, unsigned slice, ImgBuffer& img) const;
   ImgBuffer* FindImage(unsigned channel, unsigned slice) const;
   const unsigned char* GetPixels(unsigned channel, unsigned slice) const;
   bool SetPixels(unsigned channel, unsigned slice, const unsigned char* pixels);
   unsigned Width() const {return width_;}
   unsigned Height() const {return height_;}
{'fraction_non_alphanumeric': 0.1639768574908648, 'fraction_numerical': 0.001218026796589525, 'mean_word_length': 2.603400987383434, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '6497619', 'n_tokens_mistral': 1748, 'n_tokens_neox': 1640, 'n_words': 633}