dtkAbstractViewNavigator::dtkAbstractViewNavigator(void) : dtkAbstractObject(*new dtkAbstractViewNavigatorPrivate(this), 0)
{
    DTK_D(dtkAbstractViewNavigator);

    d->enabled = false;
    d->view = NULL;
}
void itkFiltersErodeProcess::setParameter(double data, int channel)
{
    if (channel != 0)
        return;
    
    DTK_D(itkFiltersErodeProcess);
    d->radius = data;
}
void itkFiltersDivideProcess::setParameter(double data, int channel)
{
    if (channel != 0)
        return;
    
    DTK_D(itkFiltersDivideProcess);
    d->divideFactor = data;
}
int itkFiltersGaussianProcess::tryUpdate()
{
    DTK_D(itkFiltersGaussianProcess);
    
    int res = DTK_FAILURE;

    if ( d->input )
    {
        QString id = d->input->identifier();

        if ( id == "itkDataImageChar3" )
        {
            res = d->update<char>();
        }
        else if ( id == "itkDataImageUChar3" )
        {
            res = d->update<unsigned char>();
        }
        else if ( id == "itkDataImageShort3" )
        {
            res = d->update<short>();
        }
        else if ( id == "itkDataImageUShort3" )
        {
            res = d->update<unsigned short>();
        }
        else if ( id == "itkDataImageInt3" )
        {
            res = d->update<int>();
        }
        else if ( id == "itkDataImageUInt3" )
        {
            res = d->update<unsigned int>();
        }
        else if ( id == "itkDataImageLong3" )
        {
            res = d->update<long>();
        }
        else if ( id== "itkDataImageULong3" )
        {
            res = d->update<unsigned long>();
        }
        else if ( id == "itkDataImageFloat3" )
        {
            res = d->update<float>();
        }
        else if ( id == "itkDataImageDouble3" )
        {
            res = d->update<double>();
        }
        else
        {
            res = medAbstractProcess::PIXEL_TYPE;
        }
    }
    
    return res;
}
void itkFiltersMultiplyProcess::setParameter(double data, int channel)
{
    if (channel != 0)
        return;
 
    DTK_D(itkFiltersMultiplyProcess);
    
    d->multiplyFactor = data;
}
void itkFiltersGaussianProcess::setParameter(double data, int channel)
{
    if (channel != 0)
        return;
    
    DTK_D(itkFiltersGaussianProcess);
    
    d->sigma = data;
}
itkFiltersGaussianProcess::itkFiltersGaussianProcess(itkFiltersGaussianProcess *parent) 
    : itkFiltersProcessBase(*new itkFiltersGaussianProcessPrivate(this), parent)
{
    DTK_D(itkFiltersGaussianProcess);
    
    d->filter = this;
    d->output = NULL; 
    
     d->description = tr("ITK gaussian filter");
}
itkFiltersNormalizeProcess::itkFiltersNormalizeProcess(itkFiltersNormalizeProcess *parent) 
    : itkFiltersProcessBase(*new itkFiltersNormalizeProcessPrivate(this), parent)
{
    DTK_D(itkFiltersNormalizeProcess);
    
    d->filter = this;
    d->output = NULL;
    
    d->description = tr("ITK normalize filter");
}
itkFiltersErodeProcess::itkFiltersErodeProcess(itkFiltersErodeProcess *parent) 
    : itkFiltersProcessBase(*new itkFiltersErodeProcessPrivate(this), parent)
{
    DTK_D(itkFiltersErodeProcess);
    
    d->filter = this;
    d->output = NULL;
    d->radius = 5;
    d->description = tr("ITK Erode filter");
}
itkFiltersInvertProcess::itkFiltersInvertProcess(itkFiltersInvertProcess *parent) 
    : itkFiltersProcessBase(*new itkFiltersInvertProcessPrivate(this), parent)
{
    DTK_D(itkFiltersInvertProcess);
    
    d->filter = this;
    d->output = NULL;
    
     d->description = tr("ITK invert intensity filter");
}
itkFiltersMultiplyProcess::itkFiltersMultiplyProcess(itkFiltersMultiplyProcess *parent) 
    : itkFiltersProcessBase(*new itkFiltersMultiplyProcessPrivate(this), parent)
{
    DTK_D(itkFiltersMultiplyProcess);
    
    d->filter = this;
    d->output = NULL;
    
     d->description = tr("ITK multiply by constant filter");
}
void itkFiltersWindowingProcess::setParameter(double data, int channel)
{
    if (channel > 3)
        return;
 
    DTK_D(itkFiltersWindowingProcess);
    
    switch ( channel )
    {
    case 0:
        d->minimumIntensityValue = data;
        break;
    case 1:
        d->maximumIntensityValue = data;
        break;
    case 2:
        d->minimumOutputIntensityValue = data;
        break;
    case 3:
        d->maximumOutputIntensityValue = data;
        break;
    }
}
dtkAbstractDataDeserializer::dtkAbstractDataDeserializer(void) : dtkAbstractObject(*new dtkAbstractDataDeserializerPrivate(this), 0)
{
    DTK_D(dtkAbstractDataDeserializer);

    d->enabled = false;
}
dtkAbstractData *dtkAbstractViewNavigator::data(void)
{
    DTK_D(dtkAbstractViewNavigator);

    return d->data;
}
void dtkAbstractViewNavigator::setView(dtkAbstractView *view)
{
    DTK_D(dtkAbstractViewNavigator);

    d->view = view;
}
void dtkAbstractViewNavigator::setData(dtkAbstractData *data)
{
    DTK_D(dtkAbstractViewNavigator);

    d->data = data;
}
void dtkAbstractViewNavigator::disable(void)
{
    DTK_D(dtkAbstractViewNavigator);

    d->enabled = false;
}
void dtkAbstractViewNavigator::enable(void)
{
    DTK_D(dtkAbstractViewNavigator);

    d->enabled = true;
}
/**
 * Set the data that will be written.
 * The writer will increase the reference count of the data.
 */
void dtkAbstractDataWriter::setData(dtkAbstractData *data)
{
    DTK_D(dtkAbstractDataWriter);

    d->data = data;
}
dtkAbstractView *dtkAbstractViewNavigator::view(void)
{
    DTK_D(dtkAbstractViewNavigator);

    return d->view;
}
void dtkAbstractDataDeserializer::setData(dtkAbstractData *data)
{
    DTK_D(dtkAbstractDataDeserializer);

    d->data = data;
}
void dtkAbstractDataDeserializer::disable(void)
{
    DTK_D(dtkAbstractDataDeserializer);

    d->enabled = false;
}
void dtkAbstractDataDeserializer::enable(void)
{
    DTK_D(dtkAbstractDataDeserializer);

    d->enabled = true;
}
void dtkAbstractDataWriter::disable(void)
{
    DTK_D(dtkAbstractDataWriter);

    d->enabled = false;
}
int itkFiltersGaussianProcess::update ( void )
{
    DTK_D(itkFiltersGaussianProcess);
    
    if ( !d->input )
        return -1;

    QString id = d->input->identifier();

    qDebug() << "itkFilters, update : " << id;

    try
    {
        if ( id == "itkDataImageChar3" )
        {
            d->update<char>();
        }
        else if ( id == "itkDataImageUChar3" )
        {
            d->update<unsigned char>();
        }
        else if ( id == "itkDataImageShort3" )
        {
            d->update<short>();
        }
        else if ( id == "itkDataImageUShort3" )
        {
            d->update<unsigned short>();
        }
        else if ( id == "itkDataImageInt3" )
        {
            d->update<int>();
        }
        else if ( id == "itkDataImageUInt3" )
        {
            d->update<unsigned int>();
        }
        else if ( id == "itkDataImageLong3" )
        {
            d->update<long>();
        }
        else if ( id== "itkDataImageULong3" )
        {
            d->update<unsigned long>();
        }
        else if ( id == "itkDataImageFloat3" )
        {
            d->update<float>();
        }
        else if ( id == "itkDataImageDouble3" )
        {
            d->update<double>();
        }
        else
        {
            qDebug() << "Error : pixel type not yet implemented ("
            << id
            << ")";
            return -1;
        }
    }
    catch (itk::ExceptionObject &e)
    {
        emit failure();
        return EXIT_FAILURE;
    }
    
    return EXIT_SUCCESS;
}
int itkFiltersMultiplyProcess::update ( void )
{
    DTK_D(itkFiltersMultiplyProcess);
    
    if ( !d->input )
        return -1;

    QString id = d->input->identifier();

    qDebug() << "itkFilters, update : " << id;

    if ( id == "itkDataImageChar3" )
    {
        d->update<char>();
    }
    else if ( id == "itkDataImageUChar3" )
    {
        d->update<unsigned char>();
    }
    else if ( id == "itkDataImageShort3" )
    {
        d->update<short>();
    }
    else if ( id == "itkDataImageUShort3" )
    {
        d->update<unsigned short>();
    }
    else if ( id == "itkDataImageInt3" )
    {
        d->update<int>();
    }
    else if ( id == "itkDataImageUInt3" )
    {
        d->update<unsigned int>();
    }
    else if ( id == "itkDataImageLong3" )
    {
        d->update<long>();
    }
    else if ( id== "itkDataImageULong3" )
    {
        d->update<unsigned long>();
    }
    else if ( id == "itkDataImageFloat3" )
    {
        d->update<float>();
    }
    else if ( id == "itkDataImageDouble3" )
    {
        d->update<double>();
    }
    else
    {
        qDebug() << description()
                 <<", Error : pixel type not yet implemented ("
                 << id
                 << ")";
        return -1;
    }

    return EXIT_SUCCESS;
}
void dtkAbstractDataWriter::enable(void)
{
    DTK_D(dtkAbstractDataWriter);

    d->enabled = true;
}