<commit_before>/*==========================================================================

Portions (c) Copyright 2018 IGSIO

See Doc/copyright/copyright.txt
or http://www.slicer.org/copyright/copyright.txt for details.

Program:   igtlio
Module:    $RCSfile: igtlioConverterUtilities.cxx,v $
Date:      $Date: 2018/07/20 4:08:00 $
Version:   $Revision: 1.0 $

=========================================================================auto=*/

#include "igtlioConverterUtilities.h"

//---------------------------------------------------------------------------
void igtlioConverterUtilities::VTKTransformToIGTLTransform(vtkSmartPointer<vtkMatrix4x4> ijk2ras, const int imageSize[3], const double spacing[3], igtl::Matrix4x4 &matrix)
{
  if (ijk2ras)
    {
    // Transform
    float ntx = ijk2ras->Element[0][0] / (float)spacing[0];
    float nty = ijk2ras->Element[1][0] / (float)spacing[0];
    float ntz = ijk2ras->Element[2][0] / (float)spacing[0];
    float nsx = ijk2ras->Element[0][1] / (float)spacing[1];
    float nsy = ijk2ras->Element[1][1] / (float)spacing[1];
    float nsz = ijk2ras->Element[2][1] / (float)spacing[1];
    float nnx = ijk2ras->Element[0][2] / (float)spacing[2];
    float nny = ijk2ras->Element[1][2] / (float)spacing[2];<commit_msg>BUG: cmath header missing from igtlioConverterUtilities<commit_after>/*==========================================================================

Portions (c) Copyright 2018 IGSIO

See Doc/copyright/copyright.txt
or http://www.slicer.org/copyright/copyright.txt for details.

Program:   igtlio
Module:    $RCSfile: igtlioConverterUtilities.cxx,v $
Date:      $Date: 2018/07/20 4:08:00 $
Version:   $Revision: 1.0 $

=========================================================================auto=*/

#include "igtlioConverterUtilities.h"
#include <cmath>

//---------------------------------------------------------------------------
void igtlioConverterUtilities::VTKTransformToIGTLTransform(vtkSmartPointer<vtkMatrix4x4> ijk2ras, const int imageSize[3], const double spacing[3], igtl::Matrix4x4 &matrix)
{
  if (ijk2ras)
    {
    // Transform
    float ntx = ijk2ras->Element[0][0] / (float)spacing[0];
    float nty = ijk2ras->Element[1][0] / (float)spacing[0];
    float ntz = ijk2ras->Element[2][0] / (float)spacing[0];
    float nsx = ijk2ras->Element[0][1] / (float)spacing[1];
    float nsy = ijk2ras->Element[1][1] / (float)spacing[1];
    float nsz = ijk2ras->Element[2][1] / (float)spacing[1];
    float nnx = ijk2ras->Element[0][2] / (float)spacing[2];
    float nny = ijk2ras->Element[1][2] / (float)spacing[2];
{'fraction_non_alphanumeric': 0.3074546156817304, 'fraction_numerical': 0.04557744302819621, 'mean_word_length': 3.761029411764706, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5434894', 'n_tokens_mistral': 899, 'n_tokens_neox': 837, 'n_words': 152}