Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkChannelDescriptor.cpp
Go to the documentation of this file.
1
/*============================================================================
2
3
The Medical Imaging Interaction Toolkit (MITK)
4
5
Copyright (c) German Cancer Research Center (DKFZ)
6
All rights reserved.
7
8
Use of this source code is governed by a 3-clause BSD license that can be
9
found in the LICENSE file.
10
11
============================================================================*/
12
#include "
mitkChannelDescriptor.h
"
13
#include "
mitkMemoryUtilities.h
"
14
15
mitk::ChannelDescriptor::ChannelDescriptor
(
mitk::PixelType
type,
size_t
numOfElements,
bool
/*allocate*/
)
16
: m_PixelType(type), m_Size(numOfElements), m_Data(nullptr)
17
{
18
// MITK_INFO << "Entering ChannelDescriptor constructor.";
19
}
20
21
mitk::ChannelDescriptor::~ChannelDescriptor
()
22
{
23
// TODO: The following line should be correct but leads to an error.
24
// Solution might be: Hold PixelType on stack, return copy and implement
25
// copy constructor as well as assignment operator.
26
// delete m_PixelType;
27
}
28
29
/*
30
void mitk::ChannelDescriptor::Initialize(mitk::PixelType &type, size_t numOfElements, bool allocate)
31
{
32
if( m_PixelType.GetPixelTypeId() != type.GetPixelTypeId() )
33
{
34
MITK_WARN << "Changing pixel type for channel: " <<
35
m_PixelType.GetItkTypeAsString() << " -> " <<
36
type.GetItkTypeAsString();
37
}
38
39
m_PixelType = type;
40
41
m_Size = numOfElements * m_PixelType.GetSize();
42
43
if( allocate )
44
{
45
this->AllocateData();
46
}
47
}
48
*/
49
50
void
mitk::ChannelDescriptor::AllocateData
()
51
{
52
if
(
m_Data
==
nullptr
)
53
{
54
m_Data
= mitk::MemoryUtilities::AllocateElements<unsigned char>(
m_Size
);
55
}
56
}
mitkMemoryUtilities.h
mitk::ChannelDescriptor::ChannelDescriptor
ChannelDescriptor(mitk::PixelType type, vcl_size_t numOfElements, bool allocate=false)
Definition:
mitkChannelDescriptor.cpp:15
mitkChannelDescriptor.h
mitk::ChannelDescriptor::m_Size
vcl_size_t m_Size
Definition:
mitkChannelDescriptor.h:67
mitk::ChannelDescriptor::AllocateData
void AllocateData()
Definition:
mitkChannelDescriptor.cpp:50
mitk::ChannelDescriptor::~ChannelDescriptor
~ChannelDescriptor()
Definition:
mitkChannelDescriptor.cpp:21
mitk::ChannelDescriptor::m_Data
unsigned char * m_Data
Definition:
mitkChannelDescriptor.h:74
mitk::PixelType
Class for defining the data type of pixels.
Definition:
mitkPixelType.h:51
Source
Modules
Core
src
DataManagement
mitkChannelDescriptor.cpp
Generated on Thu Mar 12 2020 10:23:40 for Medical Imaging Interaction Toolkit by
1.8.13