def _mosaic_get_full_block(sorted_mosaics): """ Generate a full datablock containing all timepoints """ # For each slice / mosaic create a data volume block data_blocks = [] for index in range(0, len(sorted_mosaics)): data_blocks.append(_mosaic_to_block(sorted_mosaics[index])) # Add the data_blocks together to one 4d block size_x = numpy.shape(data_blocks[0])[0] size_y = numpy.shape(data_blocks[0])[1] size_z = numpy.shape(data_blocks[0])[2] size_t = len(data_blocks) full_block = numpy.zeros((size_x, size_y, size_z, size_t), dtype=data_blocks[0].dtype) for index in range(0, size_t): full_block[:, :, :, index] = data_blocks[index] # Apply the rescaling if needed common.apply_scaling(full_block, sorted_mosaics[0]) return full_block
def _singleframe_to_block(grouped_dicoms): """ Generate a full datablock containing all timepoints """ # For each slice / mosaic create a data volume block data_blocks = [] for index in range(0, len(grouped_dicoms)): print('Creating block %s of %s' % (index + 1, len(grouped_dicoms))) current_block = _stack_to_block(grouped_dicoms[index]) current_block = current_block[:, :, :, numpy.newaxis] data_blocks.append(current_block) try: full_block = numpy.concatenate(data_blocks, axis=3) except: traceback.print_exc() raise ConversionError("MISSING_DICOM_FILES") # Apply the rescaling if needed common.apply_scaling(full_block, grouped_dicoms[0][0]) return full_block
def _singleframe_to_block(grouped_dicoms): """ Generate a full datablock containing all timepoints """ # For each slice / mosaic create a data volume block data_blocks = [] for index in range(0, len(grouped_dicoms)): logger.info('Creating block %s of %s' % (index + 1, len(grouped_dicoms))) current_block = _stack_to_block(grouped_dicoms[index]) current_block = current_block[:, :, :, numpy.newaxis] data_blocks.append(current_block) try: full_block = numpy.concatenate(data_blocks, axis=3) except: traceback.print_exc() raise ConversionError("MISSING_DICOM_FILES") # Apply the rescaling if needed common.apply_scaling(full_block, grouped_dicoms[0][0]) return full_block
def _mosaic_get_full_block(sorted_mosaics): """ Generate a full datablock containing all timepoints """ # For each slice / mosaic create a data volume block data_blocks = [] for index in range(0, len(sorted_mosaics)): data_blocks.append(_mosaic_to_block(sorted_mosaics[index])) # Add the data_blocks together to one 4d block size_x = numpy.shape(data_blocks[0])[0] size_y = numpy.shape(data_blocks[0])[1] size_z = numpy.shape(data_blocks[0])[2] size_t = len(data_blocks) full_block = numpy.zeros((size_x, size_y, size_z, size_t), dtype=data_blocks[0].dtype) for index in range(0, size_t): full_block[:, :, :, index] = data_blocks[index] # Apply the rescaling if needed common.apply_scaling(full_block, sorted_mosaics[0]) return full_block