23 #include <vtkLookupTable.h> 27 if (
nullptr == dataNode)
48 extractSliceFilter->SetInput(image);
50 extractSliceFilter->SetResliceTransformByGeometry(image->
GetGeometry());
51 extractSliceFilter->SetWorldGeometry(sagittalPlaneGeometry);
52 extractSliceFilter->SetOutputDimensionality(2);
53 extractSliceFilter->SetVtkOutputRequest(
true);
54 extractSliceFilter->Update();
64 vtkImageData* imageData = extractSliceFilter->GetVtkOutput();
68 vtkSmartPointer<vtkLookupTable> lookupTable = vtkSmartPointer<vtkLookupTable>::New();
70 lookupTable->SetSaturationRange(0.0, 0.0);
71 lookupTable->SetValueRange(0.0, 1.0);
72 lookupTable->SetHueRange(0.0, 0.0);
73 lookupTable->SetRampToLinear();
75 vtkSmartPointer<vtkMitkLevelWindowFilter> levelWindowFilter = vtkSmartPointer<vtkMitkLevelWindowFilter>::New();
76 levelWindowFilter->SetLookupTable(lookupTable);
77 levelWindowFilter->SetInputData(imageData);
78 levelWindowFilter->SetMinOpacity(0.0);
79 levelWindowFilter->SetMaxOpacity(1.0);
81 imageData->GetDimensions(dims);
82 double clippingBounds[] = { 0.0,
static_cast<double>(dims[0]), 0.0, static_cast<double>(dims[1]) };
83 levelWindowFilter->SetClippingBounds(clippingBounds);
84 levelWindowFilter->Update();
85 imageData = levelWindowFilter->GetOutput();
87 QImage thumbnailImage(reinterpret_cast<const unsigned char*>(imageData->GetScalarPointer()), dims[0], dims[1], QImage::Format_ARGB32);
89 thumbnailImage = thumbnailImage.rgbSwapped().mirrored(
false,
true);
90 return QPixmap::fromImage(thumbnailImage);
const mitk::PixelType GetPixelType(int n=0) const
Returns the PixelType of channel n.
vcl_size_t GetNumberOfComponents() const
Get the number of components of which each element consists.
The LevelWindow class Class to store level/window values.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
unsigned int GetDimension() const
Get dimension of the image.
ScalarType GetUpperWindowBound() const
Image class for storing images.
MITKSEMANTICRELATIONSUI_EXPORT QPixmap GetPixmapFromImageNode(const mitk::DataNode *dataNode)
mitk::Image::Pointer image
virtual bool IsInitialized() const
Check whether the data has been initialized, i.e., at least the Geometry and other header data has be...
mitk::BaseGeometry * GetGeometry(int t=0) const
Return the geometry, which is a TimeGeometry, of the data as non-const pointer.
bool GetLevelWindow(mitk::LevelWindow &levelWindow, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="levelwindow") const
Convenience access method for level-window properties (instances of LevelWindowProperty) ...
ScalarType GetLowerWindowBound() const
Class for nodes of the DataTree.