123456789101112131415161718 |
- import numpy
- import logging
- logger = logging.getLogger(__name__)
- def normalize_image(frames, volumeId):
- logger.debug('volId: %s, float frames detected, normalize them' % volumeId)
- collection_min = frames.min()
- collection_max = frames.max()
- logger.debug('volId: %s, imagesmin: %d, imagesmax: %d' %(volumeId, collection_min, collection_max))
- # due to memory problems, we have to trigger it for each frame
- for frame in frames:
- for frame_slice in frame:
- frame_slice = (frame_slice - collection_min) / (collection_max - collection_min)
- logger.debug('volId: %s, after normalization imagesmin: %d, imagesmax: %d' %(volumeId, frames.min(), frames.max()))
|