def get_image(uuid): """ Return an uploaded image. These are handled separately from Neurosynth-generated images in order to prevent public access based on sequential IDs, as all access to uploads must be via UUIDs. """ dec = Decoding.query.filter_by(uuid=uuid).first() if dec is None: abort(404) return send_nifti(join(settings.DECODED_IMAGE_DIR, dec.filename), basename(dec.filename))
def download(val, unthresholded=False): image = Image.query.get_or_404(val) if not image.download: abort(404) # Log the download request db.session.add(Download(image_id=val, ip=request.remote_addr)) db.session.commit() # Send the file filename = image.image_file if not unthresholded \ else image.uncorrected_image_file return send_nifti(filename)
def anatomical_underlay(): return send_nifti(os.path.join(IMAGE_DIR, 'anatomical.nii.gz'), 'anatomical.nii.gz')