Modify and update the code related to the PICCS algorithm module.#650
Modify and update the code related to the PICCS algorithm module.#650coldly01 wants to merge 2 commits intoCERN:masterfrom
Conversation
AnderBiguri
left a comment
There was a problem hiding this comment.
Thanks a lot! super useful.
Can you please answer the questions, so I understand better?
| #include "GpuIds.hpp" | ||
|
|
||
| void piccs_tv(const float* img,const float* prior, float* dst,float alpha, float ratio, const long* image_size, int maxIter, const GpuIds& gpuids); | ||
| void piccs_tv(float* img,float* prior, float* dst,float alpha, float ratio, const long* image_size, int maxIter, const GpuIds& gpuids); |
There was a problem hiding this comment.
Why did you remove const here?
There was a problem hiding this comment.
This modification is an attempt I made while debugging the incorrect return value of this operator. Keeping const is a better choice.
| n_iter = 0 | ||
| if (self.regularization=="PICCS"): | ||
| # Modify the `set_res` function in the `Python\tigre\algorithms\iterative_recon_alg.py` file as needed. | ||
| res_prior = copy.deepcopy(self.res) |
There was a problem hiding this comment.
hum not sure about this. res is the current variable right? You may want to initialize the algorithm to one image, but have a prior of another, so I think there should be a new kwarg for prior
There was a problem hiding this comment.
My approach is to add the following code in the set_res function.
if init == "PICCS_priorimage":
file_path='./fdk/fdk_360ang_test.raw'
data = np.fromfile(file_path, dtype=np.float32)
nVoxel = self.geo.nVoxel
self.res=data.reshape(nVoxel)
And then call os_asd_pocs in demo.py like this.
os_asd_pocs_output=algs.os_asd_pocs(proj, geo, angles, niter, regularization="PICCS", alpha=piccs_alpha, ratio=piccs_ratio, init="PICCS_priorimage", gpuids=gpuids)
Of course a better approach would be to add a kwarg with a name like prior_image_filepath
There was a problem hiding this comment.
I think that should be the right way.
In MATLAB we have PICCS as a separate function, ideally we want to have an alias (like os_asd_pocs) for piccs and os-piccs that force you to have a kwarg of prior_image, but not a filepath, but a volume of the same shape as geo.nVoxel.
Let me know if you want to implement this change, or want me to do it before the merge (I will make commits in your branch if so).
Fixed bugs in the existing PICCS algorithm CUDA files and added additional code required to invoke the algorithm.