Skip to content

Feature #1225 generate pdf#1475

Merged
jan-petr merged 64 commits intodevelopfrom
feature-#1225-GeneratePDF
Dec 22, 2023
Merged

Feature #1225 generate pdf#1475
jan-petr merged 64 commits intodevelopfrom
feature-#1225-GeneratePDF

Conversation

@maartenhammer
Copy link
Contributor

@maartenhammer maartenhammer commented Aug 14, 2023

Linked issue

Closes #1225

How to test

You can run the pdf generator using [x, config] = xASL_qc_GenerateReport(x[, subject]), with x being the ExploreASL s struct, if no subject is provided, it will default to the subject defined in x.SUBJECT.
A Small manual has been written that goes over the basics to creating a config report for the layout.
If no configuration file is found in <dataroot>/Derivatives/ExploreASL it will use the default in the exploreASL root directory.

Manual should be moved to the docs before merging!

@maartenhammer maartenhammer added the feature New feature, enhancement or request label Aug 14, 2023
@maartenhammer maartenhammer added this to the Release 1.11.0 milestone Aug 14, 2023
@jan-petr jan-petr linked an issue Aug 15, 2023 that may be closed by this pull request
21 tasks
@jan-petr jan-petr removed this from the Release 1.11.0 milestone Aug 15, 2023
Copy link
Member

@HenkMutsaerts HenkMutsaerts left a comment

Choose a reason for hiding this comment

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

Very nice work! Some minor stuff, that are mainly about code, header, and comment consistencies, trying to keep everything readable. You currently have a lot of subfunctions where variables change names (e.g., "input") and depending on the content of the variable a different action will be triggered by a single function, that may not help readability and debugging. I would always go for simplicity, like you nicely do sometimes with things like

switch type
A -> do this subfunction
B -> do this subfunction

instead of doing the same subfunction for both A and B but inside the subfunction determining to what other subfunction A or B go

Another important issue: you use imshow and perhaps other functions from the Matlab image processing toolbox. Jan and I have put a lot of effort in not having any toolbox dependencies outside Matlab itself. This will ensure that most users can use ExploreASL (also those that didn't pay for the toolbox) and that the docker container stays lean.

Copy link
Contributor

@jan-petr jan-petr left a comment

Choose a reason for hiding this comment

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

Some minor changes needed.

@HenkMutsaerts
Copy link
Member

HenkMutsaerts commented Sep 15, 2023

Just tested this:

[x, config] = xASL_qc_GenerateReport(x[, subject]) as you state above is not working, there is only a single x output.

Then I saw 2 minor bugs which I fixed.

Finally, the current config gives an example, can you replace the default config with one that creates a similar PDF as we had? Then we can improve it from there, but then at least I can already check how it works.

Also, now if there are any pre-existing xASL reports, it will delete them; this behavior should be disabled. Only, if there already is a PDF existing with an identical filename, it should perhaps rename the new file (I wouldn't touch the old/pre-existing file).

Also, this function now is dependent on x.P, so if a filename exists but is not defined in x.P, it will not be printed. I would instead just use relative filenames, not x.P fields (those fields are only useful within ExploreASL).

@HenkMutsaerts HenkMutsaerts removed a link to an issue Oct 19, 2023
21 tasks
@HenkMutsaerts HenkMutsaerts linked an issue Oct 19, 2023 that may be closed by this pull request
21 tasks
@maartenhammer
Copy link
Contributor Author

Just tested this:

[x, config] = xASL_qc_GenerateReport(x[, subject]) as you state above is not working, there is only a single x output.

Then I saw 2 minor bugs which I fixed.

Finally, the current config gives an example, can you replace the default config with one that creates a similar PDF as we had? Then we can improve it from there, but then at least I can already check how it works.

Also, now if there are any pre-existing xASL reports, it will delete them; this behavior should be disabled. Only, if there already is a PDF existing with an identical filename, it should perhaps rename the new file (I wouldn't touch the old/pre-existing file).

Also, this function now is dependent on x.P, so if a filename exists but is not defined in x.P, it will not be printed. I would instead just use relative filenames, not x.P fields (those fields are only useful within ExploreASL).

Excellent, the changes added by you seem to improve stability when parameters are missing, as well as some householding data.

I will also improve this by including the definitions here as default for units and names if no alternatives are given.

Copy link
Contributor

@jan-petr jan-petr left a comment

Choose a reason for hiding this comment

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

Good work. No further comments.

@maartenhammer
Copy link
Contributor Author

maartenhammer commented Nov 22, 2023

Last conversations have been handled:
Translation layer added that translates ExploreASL Legacy to BIDS when turned on
Settings has been renamed to TextSettings for clarity
Image has been renamed to Image2D
scan has been renamed to Image3D
A secondary categorizer has been added (instead of a json item being Type = image2D, we now have category = "content" , type = "image".
This is to distinguish metadata json-objects (pages, blocks, settings) and content json objects(like image2d, image3d, text, QCValues).
Added translation layer to always automatically translate some of the qc parameters here. Not all have been filled in, discuss with either Jan/Henk Jan which should be filled in.
Changed default print to look more like the example given in figure 3 of the ExploreASL paper .
New default now looks like this

Edit:
Discussion with Henk-Jan on thursday.
Possible additions:
Pdfconfig json generator that reads x.output and populates a PDFconfig.json instead of using a default template in Functions->Quality Controll, add it to wrapper.
Add text elipses (...) when qc_param exceeds certain length. (added)

@maartenhammer
Copy link
Contributor Author

maartenhammer commented Nov 24, 2023

While adding text wrapping I've noticed that xASL_num2str does not convert logical to str, which the matlab native num2str does.
A minor change to xASL_num2str is added in 3e1290d which fixes this, as I assume this is a bug instead of intended behaviour. (Discussed with Jan over whatsapp).

Copy link
Contributor

@jan-petr jan-petr left a comment

Choose a reason for hiding this comment

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

I am merely blocking the merging, because some commit messages need fixing ;)

Copy link
Member

@HenkMutsaerts HenkMutsaerts left a comment

Choose a reason for hiding this comment

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

Nice work! Some questions as we discussed, to keep the current functionality of generating the PDF dependent on what was analyzed in ExploreASL.

E.g, if you have analyzed 2 ASL runs, you want to show 2 ASL runs. If you have analyzed only T1w and FLAIR, you want to only show them.

So while there might be a static part of the template/settings file, it would be nice if these things can also be generated dependently.

Copy link
Member

@HenkMutsaerts HenkMutsaerts left a comment

Choose a reason for hiding this comment

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

Some minor comments, and a bug while testing ExploreASL's TestDataSet

Copy link
Member

@HenkMutsaerts HenkMutsaerts left a comment

Choose a reason for hiding this comment

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

Few additional things.

@maartenhammer maartenhammer force-pushed the feature-#1225-GeneratePDF branch 2 times, most recently from 60a2806 to f218d7a Compare December 21, 2023 15:59
@maartenhammer
Copy link
Contributor Author

Two force pushed to incorporate two minor appends to the last commit.

Copy link
Member

@HenkMutsaerts HenkMutsaerts left a comment

Choose a reason for hiding this comment

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

My test worked fine. I have added some wishes to the follow-up issue #1476 (in which we actually implement this in ExploreASL).

maartenhammer and others added 27 commits December 22, 2023 18:02
@jan-petr jan-petr force-pushed the feature-#1225-GeneratePDF branch from 51be2f0 to c394f5e Compare December 22, 2023 17:03
@jan-petr jan-petr merged commit c394f5e into develop Dec 22, 2023
@jan-petr jan-petr deleted the feature-#1225-GeneratePDF branch December 22, 2023 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature, enhancement or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PDF Report restart

3 participants