MCPcopy Create free account
hub / github.com/MITK/MITK / AllocateZeroedVolume

Method AllocateZeroedVolume

Modules/Core/src/DataManagement/mitkImage.cpp:681–704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

679}
680
681void mitk::Image::AllocateZeroedVolume(int t, int n)
682{
683 if (!this->IsInitialized())
684 mitkThrow() << "AllocateZeroedVolume: image is not initialized. "
685 << "Call Initialize() first to set pixel type and dimensions.";
686
687 if (m_Dimension == 0 || m_Dimension > 3)
688 mitkThrow() << "AllocateZeroedVolume: unsupported image dimension " << m_Dimension
689 << " (expected 1 to 3).";
690
691 if (this->IsVolumeSet(t, n))
692 mitkThrow() << "AllocateZeroedVolume: volume at t=" << t << ", n=" << n
693 << " is already allocated.";
694
695 size_t numBytes = this->GetPixelType().GetSize();
696
697 for (unsigned int i = 0; i < m_Dimension; ++i)
698 numBytes *= m_Dimensions[i];
699
700 auto data = new unsigned char[numBytes];
701 std::memset(data, 0, numBytes);
702
703 this->SetImportVolume(data, t, n, ManageMemory);
704}
705
706bool mitk::Image::SetImportChannel(void *data, int n, ImportMemoryManagementType importMemoryManagement)
707{

Callers 7

createImageMethod · 0.80
ResetPaintingSliceMethod · 0.80
FinalizeContourMethod · 0.80
GenerateDataMethod · 0.80

Calls 5

IsVolumeSetMethod · 0.95
GetPixelTypeMethod · 0.95
SetImportVolumeMethod · 0.95
IsInitializedMethod · 0.45
GetSizeMethod · 0.45

Tested by 1

createImageMethod · 0.64