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

[Documentation] NeuroDB::MRIProcessingUtility library perldocification #225

Merged

Conversation

cmadjar
Copy link
Collaborator

@cmadjar cmadjar commented Dec 19, 2017

Using perldoc/perlpod to document MRIProcessingUtility.pm so that users can type in the terminal
perldoc MRIProcessingUtility.pm and get the documentation.

Using the pod2markdown tool from perl Pod::Markdown module, the MRIProcessingUtility.md file has been created so that we have a web displayed version of the documentation.
pod2markdown MRIProcessingUtility.pm > MRIProcessingUtility.md

Dependencies added: perldoc, Pod::Markdown, Pod::Usage

@MounaSafiHarab MounaSafiHarab self-assigned this Jan 16, 2018
Writes error log. This is a useful function that will close the log and write
error messages in case of abnormal program termination.

INPUT: notification message, fail status of the process, log directory
Copy link
Contributor

Choose a reason for hiding this comment

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

INPUTS instead of INPUT (although this is consistent in the rest of the script, but I believe the previous ones we were using INPUTS)


=head3 getFileNamesfromSeriesUID($seriesuid, @alltarfiles)

?????????????????????????????
Copy link
Contributor

Choose a reason for hiding this comment

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

This function extracts from the tarchive_files table a list of all the DICOM files with a given seriesUID. This is useful function used spcifically when running tarchiveLoader on a a partial subset of the complete DICOM tar, with the partial subset defined by the optional seriesUID argument (FYI @cmadjar; details here: #138).


INPUT: seriesUID, list of tar files

RETURNS: ???????????????????
Copy link
Contributor

Choose a reason for hiding this comment

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

Returns a list of the filenames with a given seriesUID (to be later tarred by the extract_tarchive method)


=pod

=head3 new($dbhr, $debug, $TmpDir, $logfile, $verbose) (constructor)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe use >> constructor (just for consistency)


Gets the upload ID form the mri_upload table using tarchive's SourceLocation

INPUT: tarchive's source location
Copy link
Contributor

Choose a reason for hiding this comment

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

I always get confused when we say tarchive (and in this context it is meant to be the DICOM archive not the tarchive table)

Copy link
Collaborator Author

@cmadjar cmadjar Jan 25, 2018

Choose a reason for hiding this comment

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

totally agree! Should have said DICOM archive instead

=head1 TO DO

Document the following functions:
- getFileNamesfromSeriesUID($seriesuid, @alltarfiles)
Copy link
Contributor

Choose a reason for hiding this comment

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

if you use the description above (feel free to reword), then you need to remove this line here from the TODO list


=head3 computeSNR($tarchiveID, $tarchive_srcloc, $profile)

Computes the SNR on the modalities specified in the Config table for a given
Copy link
Contributor

Choose a reason for hiding this comment

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

specified in the getSNRModalities() routine of the $profile file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oups... I thought it was in the Config table but confused it with Imaging Browser Tabulated Scan Types.

I just looked at the function and wonder if we could not have that in the Config table instead of a function in the prod file. I think I'll create a ticket on redmine to see if there are any other functions that could be moved to the Config table. I think most of them could be removed from the prod file and put into the code base with the regex they use grepped from the Config module.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be great! but again, same comment on the regex I put on your other Loris pull request; we should avoid regex if we can and use the Config way of adding using dropdowns (like we do for double data entry instruments or tabulated scan types in imaging browser). In this case, it should be done this way as the modalities you want to pick from are already in the mri_scan_type table.
just my opinion!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

even better :)

$tarchive_srcloc: The Tarchive SourceLocation
=head3 getUploadIDUsingTarchiveSrcLoc($tarchive_srcloc)

Gets the upload ID form the mri_upload table using tarchive's SourceLocation
Copy link
Contributor

Choose a reason for hiding this comment

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

please use C<> for table names mri_upload and tarchive; and the column SourceLocation


Calls the Notify->spool function to log all messages.

INPUT:
Copy link
Contributor

Choose a reason for hiding this comment

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

INPUTS... (I still would have preferred we kept them all at INPUT to be honest).


INPUT:
$message : message to be logged in the database
$error : if 'Y' it's an error log , 'N' otherwise
Copy link
Contributor

Choose a reason for hiding this comment

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

just please put the 'N' statement under the 'Y'. We did that for other scripts (and you have it like this for the $verb option) 2 lines below

protocol in the mri_protocol table based on the mincheader information using
C<&NeuroDB::MRI::identify_scan_db>. If C<$bypass_extra_file_checks> is
true, then it will bypass the additional protocol checks from the
mri_protocol_checks table using C<&extra_file_checks>.
Copy link
Contributor

Choose a reason for hiding this comment

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

C<> for the table names (same also 3 lines above for the mri_protocol table)

=head3 get_acqusitions($study_dir, \@acquisitions)

Greps the list of acquisitions in the study directory from array
C<@acquisitions>. ?????????????????????????????????????
Copy link
Contributor

Choose a reason for hiding this comment

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

I don;t think this method is used anywhere (fetching acquisitions from a .ACQ extension?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

indeed, I just tried grepping for it in the LORIS-MRI code base and found nothing. Will just say unused function that will need to be removed in another PR.


Creates the tarchive information hashref.

INPUT: tarchive's path, globArchiveLocation option
Copy link
Contributor

Choose a reason for hiding this comment

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

you mean globrchiveLocation is optional?
I believe for optional inputs, you had a standard way of mentioning them in one of the earlier methods (extract_tarchive())in this file. Maybe you can pick a convention and use it?

Copy link
Collaborator Author

@cmadjar cmadjar Jan 25, 2018

Choose a reason for hiding this comment

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

not really, this refers to the option globArchiveLocation specified as an argument of several scripts. Tried to make this clearer.

INPUT: scanner ID, tarchive information hashref, boolean if this step should be
logged

RETURNS: subject's ID hashref
Copy link
Contributor

Choose a reason for hiding this comment

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

I would specify that it is a hashref containing CandID, PSCID and Visit Label


Extracts and parses the tarchive.

INPUT: path to the tarchive, source location from the tarchive table,
Copy link
Contributor

Choose a reason for hiding this comment

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

table in C<> format


use NeuroDB::ProcessingUtility;

my $utility = NeuroDB::MRIProcessingUtility->new(
Copy link
Contributor

Choose a reason for hiding this comment

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

indentation is awkward in the SYNOPSIS section; in case you are want them to look perfect when running perldoc :)

@MounaSafiHarab
Copy link
Contributor

@cmadjar
I did a first round of looking at this; I can look again and test once some of these comments are incorporated.

@cmadjar
Copy link
Collaborator Author

cmadjar commented Jan 25, 2018

@MounaSafiHarab Thanks a lot for your comments!! I think I incorporated all of them. Let me know if there are other things to change. Will be happy to.

@@ -846,7 +846,7 @@ sub loadAndCreateObjectFile {

Renames and moves the MINC file.

INPUT:
INPUTS:
Copy link
Contributor

Choose a reason for hiding this comment

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

these inputs in the .md file looks weird (this function and 2 functions below);
please see screenshot (I think indentation is missing)

indentationissues

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: they look perfect if I run the perldoc command in aterminal (just the .md one misses the new lines)

C<@acquisitions>. ?????????????????????????????????????

INPUT: study directory, array of acquisitions ??????????????????
UNUSED FUNCTION TO BE CLEANED UP IN ANOTHER PULL REQUEST
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe just say unused here and in the TODO section, we can say removal of unused utilities/methods (such as get_acquisitions) perhaps?

Copy link
Contributor

Choose a reason for hiding this comment

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

otherwise, tested and everything else looks good.

@cmadjar
Copy link
Collaborator Author

cmadjar commented Feb 8, 2018

@MounaSafiHarab I think I integrated all your feedback. Thanks!!

- concat\_mri($minc\_files)
- registerProgs(@toregister)

Remove function get\_acqusitions($study\_dir, \\@acquisitions) that is not used
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you meant to keep either line 362 or line 366 :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@MounaSafiHarab Good catch! Should be resolved now. Thanks!

@MounaSafiHarab
Copy link
Contributor

all good, merging!

@MounaSafiHarab MounaSafiHarab merged commit c797df0 into aces:loris-mri-docs Feb 15, 2018
@cmadjar cmadjar deleted the MRIProcessingUtilityPerldoc branch February 27, 2018 16:09
@MounaSafiHarab MounaSafiHarab added this to the 19.2 milestone May 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants