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

The Medical Imaging Interaction Toolkit (MITK)

Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.

Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.

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

#ifndef mitkImageChannelSelector_h
#define mitkImageChannelSelector_h

#include <mitkSubImageSelector.h>
#include <MitkCoreExports.h>

namespace mitk
{
  /**
   * \brief Provides access to a channel of the input image.
   *
   * If the input is generated by a ProcessObject, only the required data is
   * requested. The channel number can be set via SetChannelNr().
   *
   * \ingroup Process
   * \sa SubImageSelector
   * \sa ImageSliceSelector
   * \sa ImageTimeSelector
   */
  class MITKCORE_EXPORT ImageChannelSelector : public SubImageSelector
  {
  public:
    mitkClassMacro(ImageChannelSelector, SubImageSelector);

    itkFactorylessNewMacro(Self);

    itkCloneMacro(Self);

    /** \brief Get the channel number to extract. */
    itkGetConstMacro(ChannelNr, int);
    /** \brief Set the channel number to extract. */
    itkSetMacro(ChannelNr, int);

  protected:
    ImageChannelSelector();

    ~ImageChannelSelector() override;

    /** \brief Initialize output information (geometry, pixel type, dimensions) from the input image. */
    void GenerateOutputInformation() override;

    /** \brief Set the requested region on the input to match the selected channel. */
    void GenerateInputRequestedRegion() override;

    /** \brief Extract the selected channel data from the input image. */
    void GenerateData() override;

    int m_ChannelNr;
  };

} // namespace mitk

#endif
