Skip to content

Commit

Permalink
Header (0020,0032) now only checked when -slicepos is passed on the c…
Browse files Browse the repository at this point in the history
…ommand line (#365)

* Header (0020,0032) now only used when -slicepos is passed on the command line.

* Changed warning message issued when a file does not have header (0020,0032).
  • Loading branch information
nicolasbrossard authored and cmadjar committed Jan 3, 2019
1 parent 21d0f81 commit 191d58f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dicom-archive/get_dicom_info.pl
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ =head2 Methods
my(@position) =
# ImagePositionPatient (0x0020, 0x0032)
&convert_coordinates(&split_dicom_list(&trim($dicom->value('0020', '0032'))));
if (scalar(@position) != 3) {
warn "Warning: The file: $filename is not DICOM!\n";
my $computeSlicePos = grep($_->[1] eq 'slicepos', @Variables);
if (scalar(@position) != 3 && $computeSlicePos) {
warn "Warning: DICOM header (0020,0032) not found in $filename: "
. "slice position cannot be computed. Skipping file.\n";
push my @croft, $filename;
next;
}
Expand All @@ -153,7 +155,7 @@ =head2 Methods
my(@normal) =
&vector_cross_product(\@column, \@row);
my @slc_dircos = &get_dircos(@normal);
my $slicepos = &vector_dot_product(\@position, \@slc_dircos);
my $slicepos = &vector_dot_product(\@position, \@slc_dircos) if $computeSlicePos;

# Print out variable labels
if(!$PrintedLabels && $PrintLabels) {
Expand Down

0 comments on commit 191d58f

Please sign in to comment.