<commit_before>#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE JPetSinogramTest
#include <boost/test/unit_test.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <vector>
#include <utility>
#include <fstream>
#include <iostream>
using namespace boost::numeric::ublas;

#include "./JPetSinogram.h"

BOOST_AUTO_TEST_SUITE(FirstSuite)

BOOST_AUTO_TEST_CASE(ONE_POINT_MATRIX_IN_CENTER)
{
  matrix<int> m(10, 10);
  for (unsigned int i = 0; i < 10; i++)
  {
    for (unsigned int j = 0; j < 10; j++)
    {
      m(i, j) = 0;
    }
  }

  m(5, 5) = 100;
  int views = 2;
  int scans = 10;
  std::vector<std::vector<double>> result = JPetSinogram::sinogram(m, views, scans);
  for (int i = 0; i < views; i++)
  {
    for (int j = 0; j < scans; j++)
    {
      std::cout << result[i][j] << " ";
      //if(j == 4) 
      //  BOOST_REQUIRE_EQUAL((int)result[i][j], 100);
      //else 
      //  BOOST_REQUIRE_EQUAL((int)result[i][j], 0);
    }
    std::cout << std::endl;
  }
}

BOOST_AUTO_TEST_CASE(ONE_POINT_MATRIX_NOT_IN_CENTER)
{
  matrix<int> m(10, 10);
  for (unsigned int i = 0; i < 10; i++)
  {
    for (unsigned int j = 0; j < 10; j++)
    {
      m(i, j) = 0;
    }
  }

  m(3, 3) = 100;
  int views = 2;
  int scans = 10;
  std::vector<std::vector<double>> result = JPetSinogram::sinogram(m, views, scans);
  for (int i = 0; i < views; i++)
  {
    for (int j = 0; j < scans; j++)
    {
      std::cout << (int)result[i][j] << " "; //barray[i + j * views] = (byte) projection[i][j];
    }
    std::cout << std::endl;
  }
}

BOOST_AUTO_TEST_CASE(sinogram)
{

  std::ifstream in;
  in.open("phantom.pgm");
  std::string line;
  getline(in, line);
  if (line != "P2")
  { /*error*/
  }

  unsigned int width;
  unsigned int height;
  in >> width;
  in >> height;
  int val;
  in >> val; // skip max val
  matrix<int> m(width, height);
  for (unsigned int i = 0; i < width; i++)
  {
    for (unsigned int j = 0; j < height; j++)
    {<commit_msg>Change open path in phantom test<commit_after>#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE JPetSinogramTest
#include <boost/test/unit_test.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <vector>
#include <utility>
#include <fstream>
#include <iostream>
using namespace boost::numeric::ublas;

#include "./JPetSinogram.h"

BOOST_AUTO_TEST_SUITE(FirstSuite)

BOOST_AUTO_TEST_CASE(ONE_POINT_MATRIX_IN_CENTER)
{
  matrix<int> m(10, 10);
  for (unsigned int i = 0; i < 10; i++)
  {
    for (unsigned int j = 0; j < 10; j++)
    {
      m(i, j) = 0;
    }
  }

  m(5, 5) = 100;
  int views = 2;
  int scans = 10;
  std::vector<std::vector<double>> result = JPetSinogram::sinogram(m, views, scans);
  for (int i = 0; i < views; i++)
  {
    for (int j = 0; j < scans; j++)
    {
      std::cout << result[i][j] << " ";
      //if(j == 4) 
      //  BOOST_REQUIRE_EQUAL((int)result[i][j], 100);
      //else 
      //  BOOST_REQUIRE_EQUAL((int)result[i][j], 0);
    }
    std::cout << std::endl;
  }
}

BOOST_AUTO_TEST_CASE(ONE_POINT_MATRIX_NOT_IN_CENTER)
{
  matrix<int> m(10, 10);
  for (unsigned int i = 0; i < 10; i++)
  {
    for (unsigned int j = 0; j < 10; j++)
    {
      m(i, j) = 0;
    }
  }

  m(3, 3) = 100;
  int views = 2;
  int scans = 10;
  std::vector<std::vector<double>> result = JPetSinogram::sinogram(m, views, scans);
  for (int i = 0; i < views; i++)
  {
    for (int j = 0; j < scans; j++)
    {
      std::cout << (int)result[i][j] << " "; //barray[i + j * views] = (byte) projection[i][j];
    }
    std::cout << std::endl;
  }
}

BOOST_AUTO_TEST_CASE(sinogram)
{

  std::ifstream in;
  in.open("unitTestData/JPetSinogram/phantom.pgm");
  std::string line;
  getline(in, line);
  if (line != "P2")
  { /*error*/
  }

  unsigned int width;
  unsigned int height;
  in >> width;
  in >> height;
  int val;
  in >> val; // skip max val
  matrix<int> m(width, height);
  for (unsigned int i = 0; i < width; i++)
  {
    for (unsigned int j = 0; j < height; j++)
    {
{'fraction_non_alphanumeric': 0.18296689411170078, 'fraction_numerical': 0.025271670457417236, 'mean_word_length': 2.9659318637274548, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 41, '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': '7137978', 'n_tokens_mistral': 1736, 'n_tokens_neox': 1604, 'n_words': 391}