From 7085746f7f223eec15b592178da699cf96d9b95b Mon Sep 17 00:00:00 2001 From: aditiiyer Date: Wed, 13 Nov 2019 16:35:11 -0500 Subject: [PATCH 1/3] Updated check for oblique pt position --- .../populate_planC_scan_scanInfo_field.m | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ML_Dicom/Import/populate_planC_scan_scanInfo_field.m b/ML_Dicom/Import/populate_planC_scan_scanInfo_field.m index f707d68c0..9dd9bd968 100644 --- a/ML_Dicom/Import/populate_planC_scan_scanInfo_field.m +++ b/ML_Dicom/Import/populate_planC_scan_scanInfo_field.m @@ -279,10 +279,15 @@ nCols = getTagValue(attr, '00280011'); % check for oblique scan - isOblique = 0; - if max(abs(abs(imgOri(:)) - [1 0 0 0 1 0]')) > obliqTol + if strcmpi(pPos,'oblique') isOblique = 1; + else + isOblique = 0; end +% isOblique = 0; +% if max(abs(abs(imgOri(:)) - [1 0 0 0 1 0]')) > obliqTol +% isOblique = 1; +% end if ~isOblique && (imgOri(1)-1)^2 < 1e-5 xOffset = imgpos(1) + (pixspac(2) * (nCols - 1) / 2); @@ -339,10 +344,15 @@ end % check for oblique scan - isOblique = 0; - if max(abs(abs(imgOri(:)) - [1 0 0 0 1 0]')) > obliqTol + if strcmpi(pPos,'oblique') isOblique = 1; + else + isOblique = 0; end +% isOblique = 0; +% if max(abs(abs(imgOri(:)) - [1 0 0 0 1 0]')) > obliqTol +% isOblique = 1; +% end %Rows nRows = getTagValue(attr, '00280010'); @@ -373,7 +383,7 @@ dataS = yOffset / 10; end else - dataS = yOffset / 10; + dataS = yOffset / 10; %? end From 0a7859b748166280c00fb8b9b39136181e53e998 Mon Sep 17 00:00:00 2001 From: aditiiyer Date: Wed, 13 Nov 2019 16:36:25 -0500 Subject: [PATCH 2/3] Bug fix for exporting oblique scans --- .../modules/export_image_plane_module_field.m | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/ML_Dicom/Export/modules/export_image_plane_module_field.m b/ML_Dicom/Export/modules/export_image_plane_module_field.m index c69ac15c9..6d0026b93 100644 --- a/ML_Dicom/Export/modules/export_image_plane_module_field.m +++ b/ML_Dicom/Export/modules/export_image_plane_module_field.m @@ -94,36 +94,29 @@ xV = scanInfoS.xOffset - ((scanInfoS.sizeOfDimension2-1)*scanInfoS.grid2Units)/2; yV = scanInfoS.yOffset + ((scanInfoS.sizeOfDimension1-1)*scanInfoS.grid2Units)/2; - zV = scanInfoS.zValue; + posV = scanInfoS.imagePositionPatient; + zV = posV(3)/10; coord3M = [xV, yV, zV]; ptPos = scanInfoS.patientPosition; switch type case 'scan' - if ~isempty(ptPos) && ischar(ptPos) - coord3M = convertCoordinates(coord3M, ptPos); - xV = coord3M(:,1); - yV = coord3M(:,2); - zV = coord3M(:,3); - else - %? - end + coord3M = convertCoordinates(coord3M, ptPos); + xV = coord3M(:,1); + yV = coord3M(:,2); + zV = coord3M(:,3); case 'dose' xV = doseS.coord1OFFirstPoint; yV = doseS.coord2OFFirstPoint; - zV = -doseS.zValues(end); + zV = -doseS.zValues(end); %? coord3M = [xV, yV, zV]; - if ~isempty(ptPos) && ischar(ptPos) - coord3M = convertCoordinates(coord3M, ptPos); - xV = coord3M(:,1); - yV = coord3M(:,2); - zV = coord3M(:,3); - else - %? - end + coord3M = convertCoordinates(coord3M, ptPos); + xV = coord3M(:,1); + yV = coord3M(:,2); + zV = coord3M(:,3); end From 1b829b10e57951e893149b46f0597815ad6dcd3e Mon Sep 17 00:00:00 2001 From: aditiiyer Date: Wed, 13 Nov 2019 16:44:54 -0500 Subject: [PATCH 3/3] Revert " Bug fix for exporting oblique scans" --- .../modules/export_image_plane_module_field.m | 29 ++++++++++++------- .../populate_planC_scan_scanInfo_field.m | 20 ++++--------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/ML_Dicom/Export/modules/export_image_plane_module_field.m b/ML_Dicom/Export/modules/export_image_plane_module_field.m index 6d0026b93..c69ac15c9 100644 --- a/ML_Dicom/Export/modules/export_image_plane_module_field.m +++ b/ML_Dicom/Export/modules/export_image_plane_module_field.m @@ -94,29 +94,36 @@ xV = scanInfoS.xOffset - ((scanInfoS.sizeOfDimension2-1)*scanInfoS.grid2Units)/2; yV = scanInfoS.yOffset + ((scanInfoS.sizeOfDimension1-1)*scanInfoS.grid2Units)/2; - posV = scanInfoS.imagePositionPatient; - zV = posV(3)/10; + zV = scanInfoS.zValue; coord3M = [xV, yV, zV]; ptPos = scanInfoS.patientPosition; switch type case 'scan' - coord3M = convertCoordinates(coord3M, ptPos); - xV = coord3M(:,1); - yV = coord3M(:,2); - zV = coord3M(:,3); + if ~isempty(ptPos) && ischar(ptPos) + coord3M = convertCoordinates(coord3M, ptPos); + xV = coord3M(:,1); + yV = coord3M(:,2); + zV = coord3M(:,3); + else + %? + end case 'dose' xV = doseS.coord1OFFirstPoint; yV = doseS.coord2OFFirstPoint; - zV = -doseS.zValues(end); %? + zV = -doseS.zValues(end); coord3M = [xV, yV, zV]; - coord3M = convertCoordinates(coord3M, ptPos); - xV = coord3M(:,1); - yV = coord3M(:,2); - zV = coord3M(:,3); + if ~isempty(ptPos) && ischar(ptPos) + coord3M = convertCoordinates(coord3M, ptPos); + xV = coord3M(:,1); + yV = coord3M(:,2); + zV = coord3M(:,3); + else + %? + end end diff --git a/ML_Dicom/Import/populate_planC_scan_scanInfo_field.m b/ML_Dicom/Import/populate_planC_scan_scanInfo_field.m index 9dd9bd968..f707d68c0 100644 --- a/ML_Dicom/Import/populate_planC_scan_scanInfo_field.m +++ b/ML_Dicom/Import/populate_planC_scan_scanInfo_field.m @@ -279,15 +279,10 @@ nCols = getTagValue(attr, '00280011'); % check for oblique scan - if strcmpi(pPos,'oblique') + isOblique = 0; + if max(abs(abs(imgOri(:)) - [1 0 0 0 1 0]')) > obliqTol isOblique = 1; - else - isOblique = 0; end -% isOblique = 0; -% if max(abs(abs(imgOri(:)) - [1 0 0 0 1 0]')) > obliqTol -% isOblique = 1; -% end if ~isOblique && (imgOri(1)-1)^2 < 1e-5 xOffset = imgpos(1) + (pixspac(2) * (nCols - 1) / 2); @@ -344,15 +339,10 @@ end % check for oblique scan - if strcmpi(pPos,'oblique') + isOblique = 0; + if max(abs(abs(imgOri(:)) - [1 0 0 0 1 0]')) > obliqTol isOblique = 1; - else - isOblique = 0; end -% isOblique = 0; -% if max(abs(abs(imgOri(:)) - [1 0 0 0 1 0]')) > obliqTol -% isOblique = 1; -% end %Rows nRows = getTagValue(attr, '00280010'); @@ -383,7 +373,7 @@ dataS = yOffset / 10; end else - dataS = yOffset / 10; %? + dataS = yOffset / 10; end