| 599 | } |
| 600 | |
| 601 | bool 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 | |
| 636 | bool mitk::Image::SetImportVolume(void *data, int t, int n, ImportMemoryManagementType importMemoryManagement) |
| 637 | { |
nothing calls this directly
no test coverage detected