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

The Medical Imaging Interaction Toolkit (MITK)

Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.

This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.

See LICENSE.txt or http://www.mitk.org for details.

===================================================================*/

#include "mitkNodeDisplacementFilter.h"



  mitk::NodeDisplacementFilter::NodeDisplacementFilter()
    : m_SelectedInput(-1)
  {
  }

  mitk::NodeDisplacementFilter::~NodeDisplacementFilter()
  {
  }

  bool mitk::NodeDisplacementFilter::AddNode( mitk::DataNode::Pointer node )
  {
    // Consistency Checks
    if (node.IsNull())
    {
      MITK_WARN("NodeDisplacementFilter")
        << "Null Node passed to NodeDisplacementFilter. Ignoring Node....";
      return false;
    }
    if (node->GetData() == 0)
    {
      MITK_WARN("NodeDisplacementFilter")
        << "Empty Node passed to NodeDisplacementFilter. Ignoring Node....";
      return false;
    }
    if(m_SelectedInput == -1)
      MITK_ERROR("NodeDisplacementFilter")
        << "Cannot add nodes before input Stream was selected";
      mitkThrow() << "Cannot add nodes before input Stream was selected";

    this->Update(); // make sure we are working on current data
    mitk::NavigationData::Pointer reference = this->GetOutput(m_SelectedInput);

    if (! reference->IsDataValid())
    {
      MITK_WARN("NodeDisplacementFilter")
        << "Cannot add node while selected tool is not tracked. Ignoring Node....";
      return false;
    }

    // find transformation and add node
    mitk::AffineTransform3D::Pointer inverseAffineTransform = mitk::AffineTransform3D::New();
    if ( ! reference->GetAffineTransform3D()->GetInverse(inverseAffineTransform) )
    {
      MITK_ERROR("NodeDisplacementFilter")
        << "Could not get the inverse transformation of the navigation data transformation.";<commit_msg>Fixed braces in NodeDisplacementFilter.<commit_after>/*===================================================================

The Medical Imaging Interaction Toolkit (MITK)

Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.

This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.

See LICENSE.txt or http://www.mitk.org for details.

===================================================================*/

#include "mitkNodeDisplacementFilter.h"



  mitk::NodeDisplacementFilter::NodeDisplacementFilter()
    : m_SelectedInput(-1)
  {
  }

  mitk::NodeDisplacementFilter::~NodeDisplacementFilter()
  {
  }

  bool mitk::NodeDisplacementFilter::AddNode( mitk::DataNode::Pointer node )
  {
    // Consistency Checks
    if (node.IsNull())
    {
      MITK_WARN("NodeDisplacementFilter")
        << "Null Node passed to NodeDisplacementFilter. Ignoring Node....";
      return false;
    }
    if (node->GetData() == 0)
    {
      MITK_WARN("NodeDisplacementFilter")
        << "Empty Node passed to NodeDisplacementFilter. Ignoring Node....";
      return false;
    }
    if(m_SelectedInput == -1)
    {
      MITK_ERROR("NodeDisplacementFilter")
        << "Cannot add nodes before input Stream was selected";
      mitkThrow() << "Cannot add nodes before input Stream was selected";
    }

    this->Update(); // make sure we are working on current data
    mitk::NavigationData::Pointer reference = this->GetOutput(m_SelectedInput);

    if (! reference->IsDataValid())
    {
      MITK_WARN("NodeDisplacementFilter")
        << "Cannot add node while selected tool is not tracked. Ignoring Node....";
      return false;
    }

    // find transformation and add node
    mitk::AffineTransform3D::Pointer inverseAffineTransform = mitk::AffineTransform3D::New();
    if ( ! reference->GetAffineTransform3D()->GetInverse(inverseAffineTransform) )
    {
      MITK_ERROR("NodeDisplacementFilter")
        << "Could not get the inverse transformation of the navigation data transformation.";
{'fraction_non_alphanumeric': 0.16108490566037736, 'fraction_numerical': 0.002830188679245283, 'mean_word_length': 3.914252607184241, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 15, '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': '5627419', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1083, 'n_words': 316}