CARVIEW |
Select Language
HTTP/2 302
date: Wed, 23 Jul 2025 09:37:08 GMT
content-type: text/html; charset=utf-8
content-length: 0
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
location: https://objects.githubusercontent.com/github-production-repository-file-5c1aeb/12756992/7455701?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20250723%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250723T093708Z&X-Amz-Expires=300&X-Amz-Signature=d3c8e3b5dafcd99b244f5087dcead229cdaffa68f6b58d5cc6874daff9d4f28d&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3Bfilename%3Dradon.py.txt&response-content-type=text%2Fplain
cache-control: no-cache
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
set-cookie: _gh_sess=EJJ0JNOwibof9NOeY%2Fpw46W0kpIz%2FPR4UehmuzNTXVYL1ofa4k%2BlvLuqbJmk%2BFqfksSZkrhE0HVVJL2OlLfUJde3XqMG11OE61%2BXX%2BFlYOk0wQkwUfDuvvq1Stv7FA34Fuo0IOAYyB19a8iwF5x3IgEeoEsVvRIR8aYy4Ec9g9vOt%2B2zf6CnrkWOuT32a8v7m%2BSKNtnXBvGhvl0qYXuK4UgiHV0eIIjy6j6ILanef6xeod811gf7upHL0hJuSdmS%2BXE%2BHK0CwrPXD2a2ZHMuEg%3D%3D--J79ue6QTH7yCleJu--Q%2Bhrq5oxVws9wU8G1HXEyg%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1140142859.1753263428; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 09:37:08 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 09:37:08 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: DE7A:1A99C5:85C1F9:A3713E:6880AD44
HTTP/2 200
content-type: text/plain
last-modified: Mon, 03 Mar 2025 22:50:25 GMT
etag: "0x8DD5AA5C99FB519"
server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: 86fe320b-d01e-006a-03b5-fb40ac000000
x-ms-version: 2025-05-05
x-ms-creation-time: Mon, 03 Mar 2025 16:24:54 GMT
x-ms-blob-content-md5: zoshQP9ddjpGO//rYdvNrA==
x-ms-lease-status: unlocked
x-ms-lease-state: available
x-ms-blob-type: BlockBlob
content-disposition: attachment;filename=radon.py.txt
x-ms-server-encrypted: true
via: 1.1 varnish, 1.1 varnish
fastly-restarts: 1
accept-ranges: bytes
age: 0
date: Wed, 23 Jul 2025 09:37:10 GMT
x-served-by: cache-iad-kjyo7100092-IAD, cache-bom-vanm7210089-BOM
x-cache: MISS, MISS
x-cache-hits: 0, 0
x-timer: S1753263429.962816,VS0,VE350
content-length: 2741
import numpy as np
import matplotlib.pyplot as plt
import cv2 as cv
from skimage.data import shepp_logan_phantom
from skimage.transform import radon, rescale
def draw_res(ax, sample_name, version, image, dx, dy):
ax.set_title('"{}", {}'.format(sample_name, version))
ax.set_xlabel("Projection angle (deg)")
ax.set_ylabel("Projection position (pixels)")
ax.imshow(image, cmap=plt.cm.Greys_r,
extent=(-dx, 180.0 + dx, -dy, image.shape[0] + dy),
aspect='auto')
circle_crop = True
preserve_range = False
def test(image, sample_name, ax1, ax2, ax3, ax4):
ax1.set_title("Original")
ax1.imshow(image, cmap=plt.cm.Greys_r)
theta = np.linspace(0., 180., max(image.shape), endpoint=False) # 160
if circle_crop:
mask = np.zeros(image.shape, dtype=np.uint8)
mask = cv.circle(mask, (mask.shape[1]//2, mask.shape[0]//2), min(mask.shape[0]//2, mask.shape[1]//2), 255, cv.FILLED)
res = cv.bitwise_and(image, image, mask=mask)
sinogram = radon(cv.bitwise_and(image, image, mask=mask), theta=theta, circle=circle_crop, preserve_range=preserve_range)
else:
sinogram = radon(image, theta=theta, circle=circle_crop, preserve_range=preserve_range)
if preserve_range == False:
sinogram = np.array(255*sinogram, dtype=np.uint16)
dx, dy = 0.5 * 180.0 / max(image.shape), 0.5 / sinogram.shape[0]
draw_res(ax2, sample_name, "skimage", sinogram, dx, dy)
dst = np.zeros(shape=(160,160), dtype=np.int32)
cv.ximgproc.HoughSpaceTransform(image, dst, 180.0 / 160.0, 0.0, 180.0, crop=circle_crop)
dst = np.flip(np.flip(np.transpose(dst), 0), 1)
draw_res(ax3, sample_name, "OpenCV", dst, dx, dy)
if dst.shape == sinogram.shape:
delta = (np.abs(dst-sinogram))
print(np.max(delta))
print(np.linalg.norm(delta, 2))
draw_res(ax4, sample_name, "DELTA", delta, dx, dy)
else:
print("dst.shape = {}, sinogram.shape = {}".format(dst.shape, sinogram.shape))
fig, axis = plt.subplots(3, 4, figsize=(18, 8))
#image = np.ones(shape=(160, 160), dtype=np.uint8)
#test(image, "only ones", axis[0, 0], axis[0, 1], axis[0, 2], axis[0, 3])
image = np.ones(shape=(160, 160), dtype=np.uint8)
image[50:90, 90:110] = 0
test(image, "zeroes rectangle", axis[0, 0], axis[0, 1], axis[0, 2], axis[0, 3])
image = np.zeros(shape=(160, 160), dtype=np.uint8)
image[50:90, 90:110] = 1
test(image, "ones rectangle", axis[1, 0], axis[1, 1], axis[1, 2], axis[1, 3])
image = shepp_logan_phantom()
image = rescale(image, scale=0.4, mode='reflect')
image = np.array(255*image, dtype=np.uint8)
test(image, "Shepp-logan phantom", axis[2, 0], axis[2, 1], axis[2, 2], axis[2, 3])
fig.tight_layout()
plt.show()