dicomrt_getPatientPosition.m 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. function [PatientPositionCODE] = dicomrt_getPatientPosition(study)
  2. % dicomrt_getPatientPosition(study)
  3. %
  4. % Get Patient Position
  5. % Return a number (CODE) which correspond to one of the supported cases
  6. %
  7. % Patient Position codes:
  8. %
  9. % Head First Supine (HFS) - CODE=1
  10. % Feet First Supine (FFS) - CODE=2
  11. % Head First Prone (HFP) - CODE=3
  12. % Feet First Prone (FFP) - CODE=4
  13. %
  14. % Example:
  15. %
  16. % [B]=dicomrt_getPatientPosition(A)
  17. %
  18. % if patient position is HFS, dicomrt_getPatientPosition returns "1" in B.
  19. %
  20. % See also: dicomrt_loaddose, dicomrt_ctcreate, dicomrt_createwphantom
  21. %
  22. % Copyright (C) 2002 Emiliano Spezi (emiliano.spezi@physics.org)
  23. if iscell(study) == 1 % this is a rtplan warmed for MC export: Patient Position already assigned
  24. if size(study,2) > 2
  25. CODE=study{1,2}(9);
  26. else % this is CT data
  27. study=study{1,1};
  28. end
  29. end
  30. if isstruct(study) == 1
  31. if strcmpi(study.Modality,'RTPLAN')
  32. try
  33. PatientPosition=getfield(study,'PatientSetupSequence','Item_1','PatientPosition');
  34. catch
  35. PatientPosition=input('dicomrt_getPatientPosition: Please specify Patient Position: HFS(default),FFS,HFP,FFP: ','s');
  36. if isempty(PatientPosition)==1
  37. PatientPosition='HFS';
  38. end
  39. end
  40. elseif strcmpi(study.Modality,'CT')
  41. PatientPosition=getfield(study,'PatientPosition');
  42. else
  43. error('dicomrt_getPatientPosition: could not retrieve PatientPosition field. Exit now')
  44. end
  45. if strcmpi(PatientPosition, 'HFS')
  46. PatientPositionCODE = 1;
  47. elseif strcmpi(PatientPosition, 'FFS')
  48. PatientPositionCODE = 2;
  49. elseif strcmpi(PatientPosition, 'HFP')
  50. PatientPositionCODE = 3;
  51. elseif strcmpi(PatientPosition, 'FFP')
  52. PatientPositionCODE = 4;
  53. end
  54. end