Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions

mitk::AutoCropTool Class Reference
[Classes related to InteractiveSegmentation]

Crops selected segmentations. More...

#include <mitkAutoCropTool.h>

Inheritance diagram for mitk::AutoCropTool:
Inheritance graph
[legend]
Collaboration diagram for mitk::AutoCropTool:
Collaboration graph
[legend]

List of all members.

Public Types

typedef AutoCropTool Self
typedef SegmentationsProcessingTool Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
virtual const char ** GetXPM () const
 Returns an icon in the XPM format.
virtual const char * GetName () const
 Returns the name of this tool. Make it short!

Static Public Member Functions

static Pointer New ()

Protected Member Functions

virtual bool ProcessOneWorkingData (DataNode *node)
 Subclasses should override this method.
virtual std::string GetErrorMessage ()
 Describes the error (if one occurred during processing).
 AutoCropTool ()
virtual ~AutoCropTool ()

Detailed Description

Crops selected segmentations.

See also:
mitk::Tool
QmitkInteractiveSegmentation

Last contributor: $Author$

Definition at line 37 of file mitkAutoCropTool.h.


Member Typedef Documentation

typedef itk::SmartPointer<const Self> mitk::AutoCropTool::ConstPointer

Reimplemented from mitk::SegmentationsProcessingTool.

Definition at line 41 of file mitkAutoCropTool.h.

typedef itk::SmartPointer<Self> mitk::AutoCropTool::Pointer

Reimplemented from mitk::SegmentationsProcessingTool.

Definition at line 41 of file mitkAutoCropTool.h.

Reimplemented from mitk::SegmentationsProcessingTool.

Definition at line 41 of file mitkAutoCropTool.h.

Reimplemented from mitk::SegmentationsProcessingTool.

Definition at line 41 of file mitkAutoCropTool.h.


Constructor & Destructor Documentation

mitk::AutoCropTool::AutoCropTool (  ) [protected]

Definition at line 28 of file mitkAutoCropTool.cpp.

{
}
mitk::AutoCropTool::~AutoCropTool (  ) [protected, virtual]

Definition at line 32 of file mitkAutoCropTool.cpp.

{
}

Member Function Documentation

virtual const char* mitk::AutoCropTool::GetClassName (  ) const [virtual]

Reimplemented from mitk::SegmentationsProcessingTool.

std::string mitk::AutoCropTool::GetErrorMessage (  ) [protected, virtual]

Describes the error (if one occurred during processing).

Reimplemented from mitk::SegmentationsProcessingTool.

Definition at line 46 of file mitkAutoCropTool.cpp.

{
  return "Cropping of these nodes failed:";
}
const char * mitk::AutoCropTool::GetName (  ) const [virtual]

Returns the name of this tool. Make it short!

This name has to fit into some kind of button in most applications, so take some time to think of a good name!

Implements mitk::Tool.

Definition at line 41 of file mitkAutoCropTool.cpp.

{
  return "Crop";
}
const char ** mitk::AutoCropTool::GetXPM (  ) const [virtual]

Returns an icon in the XPM format.

This icon has to fit into some kind of button in most applications, so make it smaller than 25x25 pixels.

XPM is e.g. supported by The Gimp. But if you open any XPM file in your text editor, you will see that you could also "draw" it with an editor.

Implements mitk::Tool.

Definition at line 36 of file mitkAutoCropTool.cpp.

{
  return mitkAutoCropTool_xpm;
}
static Pointer mitk::AutoCropTool::New (  ) [static]
bool mitk::AutoCropTool::ProcessOneWorkingData ( DataNode node ) [protected, virtual]

Subclasses should override this method.

See also:
ProcessAllObjects

Reimplemented from mitk::SegmentationsProcessingTool.

Definition at line 51 of file mitkAutoCropTool.cpp.

References mitk::DataNode::GetData(), mitk::AutoCropImageFilter::New(), and mitk::DataNode::SetData().

{
  if (node)
  {
    Image::Pointer image = dynamic_cast<Image*>( node->GetData() );
    if (image.IsNull()) return false;
      
//     if (image->GetDimension() == 4)
//     {
//       Tool::ErrorMessage.Send("Cropping 3D+t segmentations is not implemented. Sorry. Bug #1281");
//       return false;
//     }

    AutoCropImageFilter::Pointer cropFilter = AutoCropImageFilter::New();
    cropFilter->SetInput( image );
    cropFilter->SetBackgroundValue( 0 );
    try
    {
      cropFilter->Update();

      image = cropFilter->GetOutput();
      if (image.IsNotNull())
      {
        node->SetData( image );
      }
      else
      {
        return false;
      }
    }
    catch(...)
    {
      return false;
    }
  }

  return true;
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines