I have the code for MAR using DICOM files
But it takes much time (25s for 1 file , 30 mins for 400 files)
So I want you to reduce running time from 30mins to 1 min
def calc_mar1(self, shapes, image1):
image = apply_voi_lut(image1, self.ds)
print(image)
tmp_image = image
m = max(abs(np.min(image)),np.max(image))
image = image + m
omax = np.max(image)
image = image / omax
theta = np.linspace(0., 180., shapes[0], endpoint=False)
sinogram = skimage.transform.radon(image, theta=theta, circle=True)
# print("Sinogram:===>")
# print(np.max(sinogram))
if self.marthreshold > 0 :
eff = self.marthreshold
else:
eff = 0.65
th = 190 * eff
sinogram[sinogram > th] = th
reconstruction_fbp = skimage.transform.iradon(sinogram, theta=theta, circle=True)
# delta = np.pi / shapes[0]
# reconstruction_fbp = RLIRadonTransform(shapes[0], shapes[0] + 1, sinogram, delta)
tmp_image[tmp_image < tmp_image * 0.995 ] = 0
# print(window_width)
scaled_img = self.ds.WindowWidth * reconstruction_fbp - self.ds.WindowCenter
print("tmp_image")
print(np.max(tmp_image))
print(np.max(scaled_img))
scaled_img = scaled_img + (tmp_image / (np.max(tmp_image))) * self.ds.WindowWidth
self.tmpArray1.append(scaled_img)
# print(self.tmpArray[index1])
return