⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ecgconverter.cs

📁 ecg tool kit for medical image retrieval system
💻 CS
📖 第 1 页 / 共 3 页
字号:
			}

			return 0;
		}
		/// <summary>
		/// Function to copy demographics from one to another.
		/// </summary>
		/// <param name="src">source</param>
		/// <param name="dst">destination</param>
		/// <returns>complex</returns>
		public static int DemographicCopy(IDemographic src, IDemographic dst)
		{
			// Check for correct input.
			if ((src == null)
			||  (dst == null))
			{
				return 1;
			}

			// Do copy of all Demographics.
			int err = 0;

			dst.LastName = src.LastName;
			if (dst.LastName == null)
				err |= (0x1 << 1);

			dst.FirstName = src.FirstName;
			if (dst.FirstName == null)
				err |= (0x1 << 2);

			dst.PatientID = src.PatientID;
			if (dst.PatientID == null)
				return -1;

			dst.SecondLastName = src.SecondLastName;
			if (dst.SecondLastName == null)
				err |= (0x1 << 3);

			dst.PrefixName = src.PrefixName;
			if (dst.PrefixName == null)
				err |= (0x1 << 29);
			
			dst.SuffixName = src.SuffixName;
			if (dst.SuffixName == null)
				err |= (0x1 << 30);
			
			ushort val;
			AgeDefinition age;
			if (src.getPatientAge(out val, out age) == 0)
			{
				if (dst.setPatientAge(val, age) != 0)
				{
					err |= (0x1 << 4);
				}
			}
			else
			{
				err |= (0x1 << 4);
			}

			dst.PatientBirthDate = src.PatientBirthDate;
			if (dst.PatientBirthDate != null)
				err |= (0x1 << 5);

			HeightDefinition height;
			if (src.getPatientHeight(out val, out height) == 0)
			{
				if (dst.setPatientHeight(val, height) != 0)
				{
					err |= (0x1 << 6);
				}
			}
			else
			{
				err |= (0x1 << 6);
			}

			WeightDefinition weight;
			if (src.getPatientWeight(out val, out weight) == 0)
			{
				if (dst.setPatientWeight(val, weight) != 0)
				{
					err |= (0x1 << 7);
				}
			}
			else
			{
				err |= (0x1 << 7);
			}

			dst.Gender = src.Gender;
			if (src.Gender == Sex.Null)
				err |= (0x1 << 8);
			
			dst.PatientRace = src.PatientRace;
			if (dst.PatientRace == Race.Null)
				err |= (0x1 << 9);

			dst.AcqMachineID = src.AcqMachineID;
			if (dst.AcqMachineID == null)
				return -1;

			dst.AnalyzingMachineID = src.AnalyzingMachineID;
			if (dst.AnalyzingMachineID == null)
				err |= (0x1 << 10);

			dst.TimeAcquisition = src.TimeAcquisition;
			if (dst.TimeAcquisition.Year <= 1000)
				return -1;

			dst.BaselineFilter = src.BaselineFilter;
			if (dst.BaselineFilter == 0)
				err |= (0x1 << 11);

			dst.LowpassFilter = src.LowpassFilter;
			if (dst.LowpassFilter == 0)
				err |= (0x1 << 12);
			
			dst.FilterBitmap = src.FilterBitmap;
			if (dst.FilterBitmap == 0)
				err |= (0x1 << 13);

			dst.FreeTextFields = src.FreeTextFields;
			if (dst.FreeTextFields == null)
				err |= (0x1 << 14);

			dst.SequenceNr = src.SequenceNr;
			if (dst.SequenceNr != null)
				err |= (0x1 << 15);

			dst.AcqInstitution = src.AcqInstitution;
			if (dst.AcqInstitution == null)
				err |= (0x1 << 16);

			dst.AnalyzingInstitution = src.AnalyzingInstitution;
			if (dst.AnalyzingInstitution == null)
				err |= (0x1 << 17);

			dst.AcqDepartment = src.AcqDepartment;
			if (dst.AcqDepartment == null)
				err |= (0x1 << 18);

			dst.AnalyzingDepartment = src.AnalyzingDepartment;
			if (dst.AnalyzingDepartment == null)
				err |= (0x1 << 19);

			dst.ReferringPhysician = src.ReferringPhysician;
			if (dst.ReferringPhysician == null)
				err |= (0x1 << 20);

			dst.OverreadingPhysician = src.OverreadingPhysician;
			if (src.OverreadingPhysician == null)
				err |= (0x1 << 21);

			dst.TechnicianDescription = src.TechnicianDescription;
			if (dst.TechnicianDescription == null)
				err |= (0x1 << 22);

			dst.SystolicBloodPressure = src.SystolicBloodPressure;
			if (dst.SystolicBloodPressure != 0)
				err |= (0x1 << 23);

			dst.DiastolicBloodPressure = src.DiastolicBloodPressure;
			if (dst.DiastolicBloodPressure != 0)
				err |= (0x1 << 24);

			dst.Drugs = src.Drugs;
			if (dst.Drugs != null)
				err |= (0x1 << 25);

			dst.ReferralIndication = src.ReferralIndication;
			if (dst.ReferralIndication == null)
				err |= (0x1 << 26);

			dst.RoomDescription = src.RoomDescription;
			if (dst.RoomDescription == null)
				err |= (0x1 << 27);

			dst.StatCode = src.StatCode;
			if (dst.StatCode == 0xff)
				err |= (0x1 << 28);

			return err;
		}
		/// <summary>
		/// Function to copy diagnostic statements from one to anohter
		/// </summary>
		/// <param name="src">source</param>
		/// <param name="dst">destination</param>
		/// <returns>0 on success</returns>
		public static int DiagnosticCopy(IDiagnostic src, IDiagnostic dst)
		{
			// Check for correct input.
			if (src == null)
			{
				return 1;
			}
			if (dst == null)
			{
				return 2;
			}

			// Do copy of diagnostic
			Statements stat;
			if (src.getDiagnosticStatements(out stat) == 0)
			{
				if (dst.setDiagnosticStatements(stat) != 0)
				{
					return 8;
				}
			}
			else
			{
				return 4;
			}
			return 0;
		}
		/// <summary>
		/// Function to copy global measurments from one to another.
		/// </summary>
		/// <param name="src">source</param>
		/// <param name="dst">destination</param>
		/// <returns>0 on success</returns>
		public static int GlobalMeasurementCopy(IGlobalMeasurement src, IGlobalMeasurement dst)
		{
			// Check for correct input.
			if (src == null)
			{
				return 1;
			}
			if (dst == null)
			{
				return 2;
			}

			// Do copy of measurements
			GlobalMeasurements mes;
			if (src.getGlobalMeasurements(out mes) == 0)
			{
				if (dst.setGlobalMeasurements(mes) != 0)
				{
					return 8;
				}
			}
			else
			{
				return 4;
			}
			return 0;
		}
		/// <summary>
		/// Function to copy signals from one to anohter
		/// </summary>
		/// <param name="src">source</param>
		/// <param name="dst">destination</param>
		/// <returns>0 on success</returns>
		public static int SignalCopy(ISignal src, ISignal dst)
		{
			// Check for correct input.
			if (src == null)
			{
				return 1;
			}
			if (dst == null)
			{
				return 2;
			}

			// Do copy of signals
			Signals signals;
			if (src.getSignals(out signals) == 0)
			{
				if (dst.setSignals(signals) != 0)
				{
					return 8;
				}
			}
			else
			{
				return 4;
			}

			return 0;
		}
		/// <summary>
		/// Function to copy lead measurments from one to another.
		/// </summary>
		/// <param name="src">source</param>
		/// <param name="dst">destination</param>
		/// <returns>0 on success</returns>
		public static int LeadMeasurementCopy(ILeadMeasurement src, ILeadMeasurement dst)
		{
			// Check for correct input.
			if (src == null)
			{
				return 1;
			}
			if (dst == null)
			{
				return 2;
			}

			// Do copy of measurements
			LeadMeasurements mes;
			if (src.getLeadMeasurements(out mes) == 0)
			{
				if (dst.setLeadMeasurements(mes) != 0)
				{
					return 8;
				}
			}
			else
			{
				return 4;
			}
			return 0;
		}
		/// <summary>
		/// Function to get error during demographics conversion.
		/// </summary>
		/// <returns>-1 on error</returns>
		public static int getDemographicsError()
		{
			return _DemographicsError;
		}
		/// <summary>
		/// Function to get error during demographics conversion.
		/// </summary>
		/// <returns>error message or null</returns>
		public static string getDemographicsErrorMessage()
		{
			string ret = null;
			if (_DemographicsError == -1)
			{
				ret = "Failed to convert one of the major fields";
			}
			return ret;
		}
		/// <summary>
		/// Function to get error during diagnostic conversion.
		/// </summary>
		/// <returns>0 on success</returns>
		public static int getDiagnosticError()
		{
			return _DiagnosticError;
		}
		/// <summary>
		/// Function to get error during diagnostic conversion.
		/// </summary>
		/// <returns>error message or null</returns>
		public static string getDiagnosticErrorMessage()
		{
			string ret = null;
			switch (_DiagnosticError)
			{
				case 1:
					ret = "No Source ECG format";
					break;
				case 2:
					ret = "No Destination ECG format";
					break;
				case 4:
					ret = "Getting diagnostic from source ECG format failed";
					break;
				case 8:
					ret = "Setting diagnostic of destination ECG format failed";
					break;
			}
			return ret;
		}
		/// <summary>
		/// Function to get error during global measurements conversion.
		/// </summary>
		/// <returns>0 on success</returns>
		public static int getGlobalMeasurementsError()
		{
			return _GlobalMeasurementsError;
		}
		/// <summary>
		/// Function to get error during global measurements conversion.
		/// </summary>
		/// <returns>error message or null</returns>
		public static string getGlobalMeasurementsErrorMessage()
		{
			string ret = null;
			switch (_GlobalMeasurementsError)
			{
				case 1:
					ret = "No Source ECG format";
				break;
				case 2:
					ret = "No Destination ECG format";
				break;
				case 4:
					ret = "Getting global measurements from source ECG format failed";
				break;
				case 8:
					ret = "Setting global measurements of destination ECG format failed";
				break;
			}
			return ret;
		}
		/// <summary>
		/// Function to get error during signal conversion.
		/// </summary>
		/// <returns>0 on success</returns>
		public static int getSignalError()
		{
			return _SignalError;
		}
		/// <summary>
		/// Function to get error during signal conversion.
		/// </summary>
		/// <returns>error message or null</returns>
		public static string getSignalErrorMessage()
		{
			string ret = null;
			switch (_SignalError)
			{
				case 1:
					ret = "No Source ECG format";
				break;
				case 2:
					ret = "No Destination ECG format";
				break;
				case 4:
					ret = "Deconding signal from source ECG format failed";
				break;
				case 8:
					ret = "Encoding signal to destination ECG format failed";
				break;
			}
			return ret;
		}
		/// <summary>
		/// Function to get error during lead measurements conversion.
		/// </summary>
		/// <returns>0 on success</returns>
		public static int getLeadMeasurementsError()
		{
			return _LeadMeasurementsError;
		}
		/// <summary>
		/// Function to get error during lead measurements conversion.
		/// </summary>
		/// <returns>error message or null</returns>
		public static string getLeadMeasurementsErrorMessage()
		{
			string ret = null;
			switch (_LeadMeasurementsError)
			{
				case 1:
					ret = "No Source ECG format";
					break;
				case 2:
					ret = "No Destination ECG format";
					break;
				case 4:
					ret = "Getting lead measurements from source ECG format failed";
					break;
				case 8:
					ret = "Setting lead measurements of destination ECG format failed";
					break;
			}
			return ret;
		}
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -