Upload MRIBrainSequenceBERT
Browse files- modeling.py +8 -5
modeling.py
CHANGED
|
@@ -34,7 +34,7 @@ class MRIBrainSequenceBERT(PreTrainedModel):
|
|
| 34 |
"ImageType",
|
| 35 |
"Manufacturer",
|
| 36 |
"ManufacturerModelName",
|
| 37 |
-
"ContrastBolusAgent",
|
| 38 |
"ScanningSequence",
|
| 39 |
"SequenceVariant",
|
| 40 |
"ScanOptions",
|
|
@@ -55,8 +55,8 @@ class MRIBrainSequenceBERT(PreTrainedModel):
|
|
| 55 |
"PercentSampling",
|
| 56 |
"PercentPhaseFieldOfView",
|
| 57 |
"PixelBandwidth",
|
| 58 |
-
"ContrastBolusVolume",
|
| 59 |
-
"ContrastBolusTotalDose",
|
| 60 |
"AcquisitionMatrix",
|
| 61 |
"InPlanePhaseEncodingDirection",
|
| 62 |
"FlipAngle",
|
|
@@ -129,8 +129,11 @@ class MRIBrainSequenceBERT(PreTrainedModel):
|
|
| 129 |
return x
|
| 130 |
|
| 131 |
@staticmethod
|
| 132 |
-
def determine_plane_from_dicom(ds: pydicom.Dataset):
|
| 133 |
-
iop =
|
|
|
|
|
|
|
|
|
|
| 134 |
# Calculate the direction cosine for the normal vector of the plane
|
| 135 |
normal_vector = np.cross(iop[:3], iop[3:])
|
| 136 |
|
|
|
|
| 34 |
"ImageType",
|
| 35 |
"Manufacturer",
|
| 36 |
"ManufacturerModelName",
|
| 37 |
+
# "ContrastBolusAgent",
|
| 38 |
"ScanningSequence",
|
| 39 |
"SequenceVariant",
|
| 40 |
"ScanOptions",
|
|
|
|
| 55 |
"PercentSampling",
|
| 56 |
"PercentPhaseFieldOfView",
|
| 57 |
"PixelBandwidth",
|
| 58 |
+
# "ContrastBolusVolume",
|
| 59 |
+
# "ContrastBolusTotalDose",
|
| 60 |
"AcquisitionMatrix",
|
| 61 |
"InPlanePhaseEncodingDirection",
|
| 62 |
"FlipAngle",
|
|
|
|
| 129 |
return x
|
| 130 |
|
| 131 |
@staticmethod
|
| 132 |
+
def determine_plane_from_dicom(ds: pydicom.Dataset | dict):
|
| 133 |
+
iop = ds.get("ImageOrientationPatient", None)
|
| 134 |
+
if iop is None:
|
| 135 |
+
return None
|
| 136 |
+
iop = np.asarray(iop)
|
| 137 |
# Calculate the direction cosine for the normal vector of the plane
|
| 138 |
normal_vector = np.cross(iop[:3], iop[3:])
|
| 139 |
|