void QmitkTensorReconstructionView::TensorsToQbi()
{
    for (int i=0; i<m_TensorImages->size(); i++)
    {
        mitk::DataNode::Pointer tensorImageNode = m_TensorImages->at(i);
        MITK_INFO << "starting Q-Ball estimation";

        typedef float                                       TTensorPixelType;
        typedef itk::DiffusionTensor3D< TTensorPixelType >  TensorPixelType;
        typedef itk::Image< TensorPixelType, 3 >            TensorImageType;

        TensorImageType::Pointer itkvol = TensorImageType::New();
        mitk::CastToItkImage<TensorImageType>(dynamic_cast<mitk::TensorImage*>(tensorImageNode->GetData()), itkvol);

        typedef itk::TensorImageToQBallImageFilter< TTensorPixelType, TTensorPixelType > FilterType;
        FilterType::Pointer filter = FilterType::New();
        filter->SetInput( itkvol );
        filter->Update();

        typedef itk::Vector<TTensorPixelType,QBALL_ODFSIZE>  OutputPixelType;
        typedef itk::Image<OutputPixelType,3>                OutputImageType;

        mitk::QBallImage::Pointer image = mitk::QBallImage::New();
        OutputImageType::Pointer outimg = filter->GetOutput();
        image->InitializeByItk( outimg.GetPointer() );
        image->SetVolume( outimg->GetBufferPointer() );
        mitk::DataNode::Pointer node = mitk::DataNode::New();
        node->SetData( image );
        QString newname;
        newname = newname.append(tensorImageNode->GetName().c_str());
        newname = newname.append("_qbi");
        node->SetName(newname.toAscii());
        GetDefaultDataStorage()->Add(node);
    }
}
mitk::TensorImageSource::TensorImageSource()
{
  // Create the output. We use static_cast<> here because we know the default
  // output must be of type TOutputImage
  OutputImageType::Pointer output
    = static_cast<OutputImageType*>(this->MakeOutput(0).GetPointer()); 
  Superclass::SetNumberOfRequiredOutputs(1);
  Superclass::SetNthOutput(0, output.GetPointer());
}