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

Method SetImportSlice

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

Source from the content-addressed store, hash-verified

599}
600
601bool mitk::Image::SetImportSlice(void *data, int s, int t, int n, ImportMemoryManagementType importMemoryManagement)
602{
603 if (IsValidSlice(s, t, n) == false)
604 return false;
605 ImageDataItemPointer sl;
606 const size_t ptypeSize = this->m_ImageDescriptor->GetChannelTypeById(n).GetSize();
607
608 if (IsSliceSet(s, t, n))
609 {
610 sl = GetSliceData(s, t, n, data, importMemoryManagement);
611 if (sl->GetManageMemory() == false)
612 {
613 sl = AllocateSliceData(s, t, n, data, importMemoryManagement);
614 if (sl.GetPointer() == nullptr)
615 return false;
616 }
617 if (sl->GetData() != data)
618 std::memcpy(sl->GetData(), data, m_OffsetTable[2] * (ptypeSize));
619 sl->Modified();
620 // we have changed the data: call Modified()!
621 Modified();
622 }
623 else
624 {
625 sl = AllocateSliceData(s, t, n, data, importMemoryManagement);
626 if (sl.GetPointer() == nullptr)
627 return false;
628 if (sl->GetData() != data)
629 std::memcpy(sl->GetData(), data, m_OffsetTable[2] * (ptypeSize));
630 // we just added a missing slice, which is not regarded as modification.
631 // Therefore, we do not call Modified()!
632 }
633 return true;
634}
635
636bool mitk::Image::SetImportVolume(void *data, int t, int n, ImportMemoryManagementType importMemoryManagement)
637{

Callers

nothing calls this directly

Calls 6

ModifiedFunction · 0.85
GetChannelTypeByIdMethod · 0.80
GetPointerMethod · 0.80
GetSizeMethod · 0.45
GetDataMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected