File indexing completed on 2025-04-10 08:06:20
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include "DicomROIContour.hh"
0027
0028
0029 DicomROIContour::DicomROIContour() {}
0030
0031
0032 void DicomROIContour::SetData(std::vector<G4ThreeVector> data)
0033 {
0034 thePoints = data;
0035 if (theGeomType == "CLOSED_PLANAR") {
0036
0037 thePoints.push_back(thePoints[0]);
0038 for (size_t ii = 1; ii < thePoints.size(); ii++) {
0039 theDirections.push_back(thePoints[ii] - thePoints[ii - 1]);
0040 }
0041 theDirections.push_back(thePoints[0] - thePoints[thePoints.size() - 1]);
0042 }
0043 }
0044
0045
0046 G4double DicomROIContour::GetZ()
0047 {
0048 if (thePoints.size() == 0) {
0049 G4Exception("DicomROIContour::GetZ", "DRC001", FatalException, "No Point in contour");
0050 Print(G4cout);
0051 return DBL_MAX;
0052 }
0053 return thePoints[0].z();
0054 }
0055
0056
0057 void DicomROIContour::AddPoints(std::vector<G4ThreeVector> points)
0058 {
0059 points.push_back(points[0]);
0060 size_t npold = thePoints.size();
0061 for (size_t ii = 0; ii < points.size(); ii++) {
0062 thePoints.push_back(points[ii]);
0063 }
0064
0065 for (size_t ii = npold + 1; ii < thePoints.size(); ii++) {
0066 theDirections.push_back(thePoints[ii] - thePoints[ii - 1]);
0067 }
0068 theDirections.push_back(thePoints[npold] - thePoints[thePoints.size() - 1]);
0069 }
0070
0071
0072 void DicomROIContour::Print(std::ostream& out)
0073 {
0074 out << this << "@@@ NUMBER OF ContourImageSequences " << theImageIUIDs.size() << G4endl;
0075 for (size_t ii = 0; ii < theImageIUIDs.size(); ii++) {
0076 out << "ContourImageSequence I= " << theImageIUIDs[ii] << G4endl;
0077 }
0078 out << "@@@ GeomType " << theGeomType << " NPOINTS " << thePoints.size() << G4endl;
0079 for (size_t ii = 0; ii < thePoints.size(); ii++) {
0080 out << "(" << thePoints[ii].x() << "," << thePoints[ii].y() << "," << thePoints[ii].z() << ")"
0081 << G4endl;
0082 }
0083 }