CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
568 stars 187 forks source link

The OSSART_TV algorithm in Python has problems #592

Closed hy010227 closed 3 hours ago

hy010227 commented 3 hours ago

The results of reconstruction using OSSART and OSSART_TV are indistinguishable, and adjusting the TV parameters also produces no changes.

Moreover, I am unable to view the minTV function here; it tells me "cannot find declaration to go to."

import tigre import numpy as np import tigre.algorithms as algs import os

geo = tigre.geometry()

Distances

geo.DSD = 1300 # Distance Source Detector (mm) geo.DSO = 1000 # Distance Source Origin (mm)

Detector parameters

geo.nDetector = np.array([822, 824]) # number of pixels (px) geo.dDetector = np.array([0.192, 0.192]) # size of each pixel (mm) geo.sDetector = geo.nDetector * geo.dDetector # total size of the detector (mm)

Image parameters

geo.nVoxel = np.array([512, 512, 512]) # number of voxels (vx) geo.sVoxel = np.array([512, 512, 512]) * np.array([0.1,0.1,0.1]) # total size of the image (mm) geo.dVoxel = np.array([0.1,0.1,0.1]) # size of each voxel (mm)

Offsets

geo.offOrigin = np.array([0,0, 0]) # Offset of image from origin (mm) geo.offDetector = np.array([0, 0]) # Offset of Detector (mm) geo.mode = "cone" geo.COR = 0 geo.accuracy = 0.5 geo.rotDetector = np.array([0, 0, 0]) print(geo)

%% Load data and generate projections

angles

clockwise = -np.pi / 2 angles = np.linspace(0, 2 * np.pi, 720, endpoint=False)+ clockwise angles1 = angles[0:30] angles2 = angles[150:210] angles3 = angles[690:720] angles = np.concatenate((angles1,angles2, angles3), axis=0)

projections

proj = np.fromfile('./proj_simu.raw',dtype=np.float32).reshape(720,822,824) proj1 = proj[0:30, :, :] proj2 = proj[150:210, :, :] proj3 = proj[690:720, :, :] proj = np.concatenate((proj1, proj2, proj3),axis=0)

TV

niter = 20 imgOSSART_TV = algs.ossart_tv(proj, geo, angles, niter,tvlambda=100,tviter=20) imgOSSART_TV.astype(np.float32).tofile(os.path.join('./TV/','TVsimuiter20-30-30_150-210.raw'))

I adjusted the TV parameters to a large value to observe whether TV has any effect

Specifications

AnderBiguri commented 3 hours ago

duplicate of #591

hy010227 commented 3 hours ago

heyu @.***

 

------------------ 原始邮件 ------------------ 发件人: "CERN/TIGRE" @.>; 发送时间: 2024年10月15日(星期二) 晚上8:00 @.>; @.**@.>; 主题: Re: [CERN/TIGRE] The OSSART_TV algorithm in Python has problems (Issue #592)

duplicate of #591

 The following is the reconstruction code. I have made various changes to tvlambda and tviter, but I found no improvement in the images compared to OSSART. I have tried the parameters 0.2, 50, and 100 for tvlambda, but there was no difference. 

import tigre

import numpy as np

import tigre.algorithms as algs

import os

geo = tigre.geometry()

Distances

geo.DSD = 1300 # Distance Source Detector      (mm)

geo.DSO = 1000  # Distance Source Origin        (mm)

Detector parameters

geo.nDetector = np.array([822, 824])  # number of pixels              (px)

geo.dDetector = np.array([0.192, 0.192])  # size of each pixel            (mm)

geo.sDetector = geo.nDetector * geo.dDetector  # total size of the detector    (mm)

Image parameters

geo.nVoxel = np.array([512, 512, 512])  # number of voxels              (vx)

geo.sVoxel = np.array([512, 512, 512]) * np.array([0.1,0.1,0.1])  # total size of the image       (mm)

geo.dVoxel = np.array([0.1,0.1,0.1])  # size of each voxel            (mm)

Offsets

geo.offOrigin = np.array([0,0, 0])  # Offset of image from origin   (mm)

geo.offDetector = np.array([0, 0])  # Offset of Detector            (mm)

geo.mode = "cone"

geo.COR = 0

geo.accuracy = 0.5

geo.rotDetector = np.array([0, 0, 0])

print(geo)

%% Load data and generate projections

angles

clockwise = -np.pi / 2

angles = np.linspace(0, 2 * np.pi, 720, endpoint=False)+ clockwise

angles1 = angles[0:30]

angles2 = angles[150:210]

angles3 = angles[690:720]

angles = np.concatenate((angles1,angles2, angles3), axis=0)

projections

proj = np.fromfile('./proj_simu.raw',dtype=np.float32).reshape(720,822,824)

proj1 = proj[0:30, :, :]

proj2 = proj[150:210, :, :]

proj3 = proj[690:720, :, :]

proj = np.concatenate((proj1, proj2, proj3),axis=0)

SART

niter = 20

imgOSSART_TV = algs.ossart_tv(proj, geo, angles, niter,tvlambda=100,tviter=20)

imgOSSART_TV.astype(np.float32).tofile(os.path.join('./TV/','TVsimuiter20-30-30_150-210.raw'))

this is result of SART.

 

this is  result of TV。

Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>