time | Calls | line |
---|
| | 686 | function validateSizes(data)
|
| | 687 |
|
| | 688 | % How many bytes does each element occupy in memory?
|
< 0.001 | 10 | 689 | switch (class(data))
|
< 0.001 | 10 | 690 | case {'uint8', 'int8', 'logical'}
|
| | 691 |
|
< 0.001 | 10 | 692 | elementSize = 1;
|
| | 693 |
|
| | 694 | case {'uint16', 'int16'}
|
| | 695 |
|
| | 696 | elementSize = 2;
|
| | 697 |
|
| | 698 | case {'uint32', 'int32', 'single'}
|
| | 699 |
|
| | 700 | elementSize = 4;
|
| | 701 |
|
| | 702 | case {'uint64', 'int64', 'double'}
|
| | 703 |
|
| | 704 | elementSize = 8;
|
| | 705 |
|
< 0.001 | 10 | 706 | end
|
| | 707 |
|
| | 708 | % Validate that the dataset/image will fit within 32-bit offsets.
|
< 0.001 | 10 | 709 | max32 = double(intmax('uint32'));
|
| | 710 |
|
< 0.001 | 10 | 711 | if (any(size(data) > max32))
|
| | 712 |
|
| | 713 | error(message('MATLAB:imagesci:imwrite:sideTooLong'))
|
| | 714 |
|
< 0.001 | 10 | 715 | elseif ((numel(data) * elementSize) > max32)
|
| | 716 |
|
| | 717 | error(message('MATLAB:imagesci:imwrite:tooMuchData'))
|
| | 718 |
|
< 0.001 | 10 | 719 | end
|
< 0.001 | 10 | 720 | end
|
Other subfunctions in this file are not included in this listing.