Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ml_norm for virtual crystals #833

Merged
merged 10 commits into from Sep 24, 2021
Merged

ml_norm for virtual crystals #833

merged 10 commits into from Sep 24, 2021

Conversation

gefeichen
Copy link
Contributor

normfile
I got it by dividing normalized projdata by raw projdata (mCT).
And no zero value found in

measured_fan_data(ra,a,rb,b) = 0;
after make_fan_data_remove_gaps

    I modified ml_norm3d code with virtual crystal, i.e., make_fan_data_remove_gap, set_fan_data_add_gap, ML_norm. new_max_delta in ML_norm.cxx may be wrong.
@gefeichen gefeichen marked this pull request as ready for review February 24, 2021 06:43
@gefeichen gefeichen changed the title Test ml_nom_virtual_crystal Feb 24, 2021
@gefeichen
Copy link
Contributor Author

sinogram after norm
And another image: upper is a cylinder sinogram, below is a sinogram after normalisation

Copy link
Collaborator

@KrisThielemans KrisThielemans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very nice to me. Thanks a lot.

I have 2 suggestions in the review below. In addition, I think we should get rid of the old make_fan_data and its inverse. Otherwise we keep too much code duplication.

Add yourself as author and whoever owns your copyright in the headers. Also, add a note in release_5.0.htm in section changed functionality.

Comment on lines +1060 to +1062
const int num_physical_transaxial_crystals_per_block = num_transaxial_crystals_per_block - virtual_transaxial_crystals;

const int num_physical_axial_crystals_per_block = num_axial_crystals_per_block - virtual_axial_crystals;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could just as well provide the member functions for these 2 as well.

int new_b = b - b/num_transaxial_crystals_per_block;
int new_ra = ra - ra/ num_axial_crystals_per_block;
int new_rb = rb - rb/num_axial_crystals_per_block;
(*segment_ptr)[bin.axial_pos_num()][bin.view_num()][bin.tangential_pos_num()] = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we use an extra input argument to the function gap_value, defaulting to 0. It will also make it clearer what's happening here.

@KrisThielemans KrisThielemans changed the title ml_nom_virtual_crystal ml_norm for virtual crystals Feb 24, 2021
@KrisThielemans
Copy link
Collaborator

I believe this supersedes your other PR. If so, please close it by referring to this one.

I don't understand the first picture. Can you provide a bit more detail?

@gefeichen
Copy link
Contributor Author

I believe this supersedes your other PR. If so, please close it by referring to this one.

I don't understand the first picture. Can you provide a bit more detail?

I used a cylinder source in gPET to cover the whole FOV and generated corresponding model projection data.

It's hard to visualize the norm parameter. So I just use manip_segments to divide model_data by measure_data. And the result shows in the first picture. Maybe it's useless.

@KrisThielemans
Copy link
Collaborator

easier to look at the inverse of it:

stir_math -s --including-first --power -1 eff_factors.hs norm_factors.hs

could do the trick

@KrisThielemans
Copy link
Collaborator

I'd also compare measured data with model*eff_factors. I think you get the latter with apply_normfactors3D with apply_or_undo=1.

@gefeichen
Copy link
Contributor Author

The absolute difference of measure and model*eff_factors is 19%
sum(abs(model*eff-measure))/sum(measure)
I don't know whether it is correct.

Below is eff and geo factors. left:eff right:geo
normeffgeo

@KrisThielemans
Copy link
Collaborator

The absolute difference of measure and model*eff_factors is 19%

they will be different because of noise of course. Hard to quantify that. But 19% doesn't look too bad. efficiencies look a bit strange but could be alright.

I note that my text was confusing. with "eff_factors" I meant "eff*geo" (i.e. the total efficiency, also known as "1/norm_factors"). I'll call them "total_eff_factors" below.

Things to compare measured with model*total_eff_factors:

  • visual comparison of
  • profiles. you will probably have to do some averaging to reduce noise.
  • reconstruction of the gate data used for normalisation (lm_to_projdata with excluding scatters and randoms, no background in recon).
  • reconstruction of other gate data (lm_to_projdata with excluding scatters and randoms, no background in recon).
  • reconstruction of other gate data full pipeline (although that doesn't have anything to do with the norm)

Are you using https://github.com/UCL/STIR-GATE-Connection? If so, it tells you how to handle the norm (currently BinNormalisationFromProjData needs the norm-factors, not the total_eff_factors)

Copy link
Collaborator

@KrisThielemans KrisThielemans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you merge master in here to resolve the conflict? sorry.

/// **** This function make proj_data from fan_data while adding the intermodule gaps **** ////
/// *** fan_data doesn't have gaps, proj_data has gaps *** ///
void set_fan_data_add_gaps(ProjData& proj_data,
const FanProjData& fan_data)
const FanProjData& fan_data, const int gap_value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

float please

void set_fan_data_add_gaps(ProjData& proj_data,
const FanProjData& fan_data);
const FanProjData& fan_data,
const int gap_value=0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const int gap_value=0);
const float gap_value=0.F);

@KrisThielemans
Copy link
Collaborator

@gefeichen, will your mCT tests be affected by #838 and/or #837?

@NikEfth
Copy link
Collaborator

NikEfth commented Mar 7, 2021

Hi , I am sorry for the delay, I will test with my data tonight.

Copy link
Collaborator

@NikEfth NikEfth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gefeichen
Thank you for your good work,
I don't have mCT data but from my data (which as we had discussed are slightly different ) (and your code) I saw that the last segment was coming out empty.
I don't think that this actually has to do with your modifications but, could you please check you last, and second to last segments? I believe that those would be +54 and +53 (?), might be wrong, though.

const int num_axial_blocks_in_max_delta = max_delta/(num_axial_crystals_per_block);
const int new_max_delta = max_delta - (num_axial_blocks_in_max_delta)*virtual_axial_crystals;
const int num_physical_detectors_per_ring = num_detectors_per_ring - num_transaxial_blocks*virtual_transaxial_crystals;
const int num_physical_rings = num_rings - (num_axial_blocks-1)*virtual_axial_crystals;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this.

@gefeichen
Copy link
Contributor Author

Hi @NikEfth
Thanks for your checking.
Could you provide more information about your data? Like ring numbers, virtual crystal number, and position

@KrisThielemans
Copy link
Collaborator

This seems ready to me now, and we have the signed letter.

@NikEfth if you have any final comments, let us know. Otherwise I'll merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants