/*******************************************************************************
 *  Copyright 2017-2018 Centre for Development of Advanced Computing(C-DAC), Pune
 *  
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *  
 *   http://www.apache.org/licenses/LICENSE-2.0
 *  
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package cdac.medinfo.sdk.dcm30_04.baselibs;

import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataElement;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataSet;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDictionaryReader;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IItem;
import cdac.medinfo.sdk.dcm30_04.enums.EnumDetectorActiveShape;
import cdac.medinfo.sdk.dcm30_04.enums.EnumDetectorConditionsNominalFlag;
import cdac.medinfo.sdk.dcm30_04.enums.EnumDetectorConfiguration;
import cdac.medinfo.sdk.dcm30_04.enums.EnumDetectorType;
import cdac.medinfo.sdk.dcm30_04.exceptions.ConditionFailedException;
import cdac.medinfo.sdk.dcm30_04.exceptions.InvalidMacroException;
import cdac.medinfo.sdk.dcm30_04.exceptions.MandatoryMissingException;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConfig;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConstants;
import cdac.medinfo.sdk.dcm30_04.utils.DicomLogger;

/**
 * This class contains the macro which contains common attributes that describe digital X-Ray detector.
 */
public class DigitalXRayDetectorMacro extends Macro
{

	private static final long serialVersionUID = 1L;
	ExposureIndexMacro objExposureIndexMacro = null;
	/**
	 * This constructor constructs a Macro with specified Data Set.
	 * @param objDataSet Collection of Data Elements 
	 */
	
	/**
	 * Validates all the attributes in DigitalXRayDetectorMacro
	 * @return boolean - Success -true, Failure -false.
	 * @throws InvalidMacroException throws InvalidMacroException If Mandatory or Conditional element fails.
	 */
	public boolean validate() throws InvalidMacroException
	{
		if(iMacroLevel == DicomConstants.DCM_MODULE_LEVEL_MACRO)
			return validate(objIDataSet);
		else if(iMacroLevel == DicomConstants.DCM_ITEM_LEVEL_MACRO)
			return validate(objIItem);
		return false;
	}
	
	/**
	 * Validates all the attributes in DigitalXRayDetectorMacro that are present in the DataSet
	 * @param objIDataSet collection of DataElements
	 * @return boolean - Success -true, Failure - false
	 * @throws InvalidMacroException throws InvalidMacroException If Mandatory or Conditional element fails.
	 */
	public static boolean validate(IDataSet objIDataSet) throws InvalidMacroException
	{
		try
		{ 

			//validate condition here
		}
		catch( ConditionFailedException ce)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(ce.getMessage());
			}
			throw new InvalidMacroException( LensometryMeasurementsMacro.class.getSimpleName() ,ce); 
		}
		catch( MandatoryMissingException me)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(me.getMessage());
			}
			throw new InvalidMacroException(LensometryMeasurementsMacro.class.getSimpleName() ,me);
		}
		return true;
	}

	/**
	 * Validates all the attributes in DigitalXRayDetectorMacro that are present in the DataSet
	 * @param objIItem collection of DataElements in a sequence
	 * @return boolean - Success -true, Failure - false
	 * @throws InvalidMacroException throws InvalidMacroException If Mandatory or Conditional element fails.
	 */
	public static boolean validate(IItem objIItem) throws InvalidMacroException
	{
		try
		{  
			//validate condition here
		}
		catch( ConditionFailedException ce)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(ce.getMessage());
			}
			throw new InvalidMacroException(LensometryMeasurementsMacro.class.getSimpleName(),ce); 
		}
		catch( MandatoryMissingException me)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(me.getMessage());
			}
			throw new InvalidMacroException(LensometryMeasurementsMacro.class.getSimpleName(),me);
		}
		return true;
	}
	public DigitalXRayDetectorMacro(IDataSet objDataSet)
	{
		super(objDataSet);
	}

	/**
	 * This constructor constructs a Macro with specified Data Set and Dictionary Reader
	 * @param objDataSet specifies the DataSet
	 * @param objDictionaryReader specifies the DICOM Dictionary reader to be used 
	 */
	public DigitalXRayDetectorMacro(IDataSet objDataSet,IDictionaryReader objDictionaryReader)
	{
		super(objDataSet,objDictionaryReader);
	}

	/**
	 * This constructor constructs a Macro with the specified Item
	 * @param objItem specifies instance of Item class
	 */
	public DigitalXRayDetectorMacro(IItem objItem)
	{
		super(objItem);
	}

	/**
	 * This constructor constructs a Macro with the specified Item and DictionaryReader
	 * @param objItem specifies instance of Item class
	 * @param objDictionaryReader specifies the DICOM Dictionary reader to be used 
	 */
	public DigitalXRayDetectorMacro(IItem objItem,IDictionaryReader objDictionaryReader)
	{
		super(objItem, objDictionaryReader);
	}

	/**
	 * Sets the Detector Type Defined in Terms of TEXT,NUMERIC,CODE,DATE,TIME,PNAME
	 * @param enumDetectorType Specifies type of the value encoded in this Item
	 */
	public void setDetectorType(EnumDetectorType enumDetectorType)
	{
		/* Accept the Detector Type in String format of type CS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018, 0x7004, enumDetectorType,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018, 0x7004,DicomConstants.DCM_DT_CS, enumDetectorType);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves type of the value encoded in this Item
	 * @return String - Type of the value encoded in this Item
	 */
	public String getDetectorType()
	{
		Object objValue = getValue(0x0018, 0x7004);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	
	/**
	 * Sets the Detector Type Defined in Terms of TEXT,NUMERIC,CODE,DATE,TIME,PNAME
	 * @param DetectorConfiguration Specifies type of the value encoded in this Item
	 */
	public void setDetectorConfiguration(EnumDetectorConfiguration enumDetectorConfiguration)
	{
		/* Accept the Detector Configuration in String format of type CS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018, 0x7005, enumDetectorConfiguration,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018, 0x7005,DicomConstants.DCM_DT_CS, enumDetectorConfiguration);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves type of the value encoded in this Item
	 * @return String - Type of the value encoded in this Item
	 */
	public String getDetectorConfiguration()
	{
		Object objValue = getValue(0x0018, 0x7005);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * Sets free form text description of Detector Description (0x0018, 0x7006,) 
	 * @param strConfigurationInformationDescription String value of Configuration Information Description.
	 */
	public void setDetectorDescription(String strDetectorDescription)
	{
		/* Accept Configuration Information Description of type LT.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018, 0x7006, strDetectorDescription,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018, 0x7006,DicomConstants.DCM_DT_LT, strDetectorDescription);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves description of Configuration Information (2010,0150) supported by the printer.
	 * @return String - value of description of Configuration Information (2010,0150) supported by the printer.
	 */
	public String getDetectorDescription()
	{
		Object objValue = getValue(0x0018, 0x7006);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets free form text description of DetectorMode (0x0018, 0x7008,) 
	 * @param strConfigurationInformationDescription String value of Configuration Information Description.
	 */
	public void setDetectorMode(String strDetectorMode)
	{
		/* Accept Configuration Information Description of type LT.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018, 0x7008, strDetectorMode,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018, 0x7008,DicomConstants.DCM_DT_LT, strDetectorMode);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves description of Configuration Information (0018,7008) supported by the printer.
	 * @return String - value of description of Configuration Information (0018,7008) supported by the printer.
	 */
	public String getDetectorMode()
	{
		Object objValue = getValue(0x0018, 0x7008);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets the DetectorID.
	 * @param strDetectorID
	 */
	public void setDetectorID(String strDetectorID)
	{
		/* Accept the DetectorID in String format of type SH.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018, 0x700A, strDetectorID,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018, 0x700A,DicomConstants.DCM_DT_SH, strDetectorID);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves The ID or serial number of the detector used to acquire this image
	 * @return String - value of Energy Window Name.
	 */
	public String getDetectorID()
	{
		Object objValue = getValue(0x0018, 0x700A);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets Date of print Last Detector Calibration.
	 * @param strDateofLastDetectorCalibration String value of Date of print job creation.
	 */
	public void setDateofLastDetectorCalibration(String strDateofLastDetectorCalibration)
	{
		/* Accept the Creation Date of type DA.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x700C,strDateofLastDetectorCalibration,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x700C,DicomConstants.DCM_DT_DA, strDateofLastDetectorCalibration);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Date of print job creation.
	 * @return String - value of Date of print job creation.
	 */
	public String getDateofLastDetectorCalibration()
	{
		Object objValue = getValue(0x0018,0x700C);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets Time when the printer was last calibrated.
	 * @param strTimeofLastDetectorCalibration String array of Time when the printer was last calibrated.
	 */
	public void setTimeofLastDetectorCalibration(String[] strTimeofLastDetectorCalibration)
	{
		/* Accept Time of Last Calibration of type TM.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x700E,strTimeofLastDetectorCalibration,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x700E,DicomConstants.DCM_DT_TM,strTimeofLastDetectorCalibration);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Time when the printer was last calibrated.
	 * @return String - value of Time when the printer was last calibrated.
	 */
	public String[] getTimeofLastDetectorCalibration()
	{
		Object objValue = getValue(0x0018,0x700E);
		if(objValue != null)
			return (String[])objValue;
		return null;
	}

	/**
	 * Sets ExposuresonDetectorSinceLastCalibration
	 * @param strExposuresonDetectorSinceLastCalibrationr String value of Exposures on Detector Since Last Calibration
	 */
	public void setExposuresonDetectorSinceLastCalibration (String strExposuresonDetectorSinceLastCalibration )
	{ 
		/*Accept the Exposures on Detector Since Last Calibration  in String format of type IS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x7010, strExposuresonDetectorSinceLastCalibration ,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x7010,DicomConstants.DCM_DT_IS, strExposuresonDetectorSinceLastCalibration );

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves ExposuresonDetectorSinceLastCalibration
	 * @return String - value of Exposures on Detector Since Last Calibration
	 */
	public String getExposuresonDetectorSinceLastCalibration()
	{
		Object objValue = getValue(0x0018,0x7010);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets ExposuresonDetectorSinceLastCalibration
	 * @param strExposuresonDetectorSinceLastCalibrationr String value of Exposures on Detector Since Last Calibration
	 */
	public void setExposuresonDetectorSinceManufactured(String strExposuresonDetectorSinceManufactured)
	{ 
		/*Accept the Exposures on Detector Since Last Calibration  in String format of type IS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x7011, strExposuresonDetectorSinceManufactured ,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x7011,DicomConstants.DCM_DT_IS, strExposuresonDetectorSinceManufactured);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves ExposuresonDetectorSinceManufactured
	 * @return String - value of Exposures on Detector Since Manufactured
	 */ 
	public String getExposuresonDetectorSinceManufactured()
	{
		Object objValue = getValue(0x0018,0x7011);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets Slice Thickness.Uniquely identifies Slice Thickness(0018,0050) in Pixel Measures Sequence(0028,9110).
	 * @param strDetectorTimeSinceLastExposure String value of Slice Thickness.
	 */
	public void setDetectorTimeSinceLastExposure(String strDetectorTimeSinceLastExposure)
	{
		/* Accept the DetectorTimeSinceLastExposure in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x7012, strDetectorTimeSinceLastExposure,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x7012,DicomConstants.DCM_DT_DS, strDetectorTimeSinceLastExposure);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Detector Time Since Last Exposure
	 * @return String - value of DetectorTimeSinceLastExposure
	 */
	public String getDetectorTimeSinceLastExposure()
	{
		Object objValue = getValue(0x0018,0x7012);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	
	/**
	 * Sets Detector Binning
	 * @param strDetectorBinning String value of Detector Binning.
	 */
	public void setDetectorBinning(String strDetectorBinning)
	{
		/* Accept the DetectorTimeSinceLastExposure in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x701A, strDetectorBinning,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x701A,DicomConstants.DCM_DT_DS, strDetectorBinning);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Detector Time Since Last Exposure
	 * @return String - value of DetectorTimeSinceLastExposure
	 */
	public String getDetectorBinning()
	{
		Object objValue = getValue(0x0018,0x701A);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets Detector Manufacturer Name.
	 * @param strRescaleType String value of DetectorManufacturerName.
	 */
	public void setDetectorManufacturerName(String strDetectorManufacturerName)
	{
		/* Accept the Detector Manufacturer Name in String format of type LO.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x702A, strDetectorManufacturerName,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x702A,DicomConstants.DCM_DT_LO, strDetectorManufacturerName);

		addDataElement(objIDataElement);
	}

	/**
	 * Return user-defined label identifier for DetectorManufacturerName.
	 * @return String - value of Detector Manufacturer Name.
	 */
	public String getDetectorManufacturerName()
	{
		Object objValue = getValue(0x0018,0x702A);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	
	/**
	 * Sets Detector DetectorManufacturersModelName
	 * @param strDetectorManufacturersModelName String value of DetectorManufacturersModelName.
	 */
	public void setDetectorManufacturersModelName(String strDetectorManufacturersModelName)
	{
		/* Accept the Detector Manufacturer Model Name in String format of type LO.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x702B, strDetectorManufacturersModelName,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x702B,DicomConstants.DCM_DT_LO, strDetectorManufacturersModelName);

		addDataElement(objIDataElement);
	}

	/**
	 * Return user-defined label identifier for DetectorManufacturerName.
	 * @return String - value of Detector Manufacturer Name.
	 */
	public String getDetectorManufacturersModelName()
	{
		Object objValue = getValue(0x0018,0x702B);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets the Detector Conditions Nominal Flag Defined in Terms of TEXT,NUMERIC,CODE,DATE,TIME,PNAME
	 * @param strDetectorConditionsNominalFlag Specifies type of the value encoded in this Item
	 */
	public void setDetectorConditionsNominalFlag(EnumDetectorConditionsNominalFlag enumDetectorConditionsNominalFlag)
	{
		/* Accept the Detector Conditions Nominal Flag in String format of type CS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018, 0x7000, enumDetectorConditionsNominalFlag,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018, 0x7000,DicomConstants.DCM_DT_CS, enumDetectorConditionsNominalFlag);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves type of the value encoded in this Item
	 * @return String - Type of the value encoded in this Item
	 */
	public String getDetectorConditionsNominalFlag()
	{
		Object objValue = getValue(0x0018, 0x7000);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	/**
	 * Sets Detector Temperature.Uniquely identifies Detector Temperature.
	 * @param strDetectorTemperature String value of Detector Temperature.
	 */
	public void setDetectorTemperature(String strDetectorTemperature)
	{
		/* Accept the DetectorTemperature in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x7001, strDetectorTemperature,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x7001,DicomConstants.DCM_DT_DS, strDetectorTemperature);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Detector Temperature.
	 * @return String - value of Detector Temperature.
	 */
	public String getDetectorTemperature()
	{
		Object objValue = getValue(0x0018,0x7001);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets Sensitivity.Uniquely identifies Sensitivity.
	 * @param strSensitivity String value of Detector Temperature.
	 */
	public void setSensitivity(String strSensitivity)
	{
		/* Accept the Sensitivity in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x6000, strSensitivity,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x6000,DicomConstants.DCM_DT_DS, strSensitivity);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Detector Temperature.
	 * @return String - value of Detector Temperature.
	 */
	public String getSensitivity()
	{
		Object objValue = getValue(0x0018,0x6000);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets DetectorElementPhysicalSize.Uniquely identifies DetectorElementPhysicalSize.
	 * @param strDetectorElementPhysicalSize String value of Detector Temperature.
	 */
	public void setDetectorElementPhysicalSize(String strDetectorElementPhysicalSize)
	{
		/* Accept the DetectorElementPhysicalSize in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x7020, strDetectorElementPhysicalSize,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x7020,DicomConstants.DCM_DT_DS, strDetectorElementPhysicalSize);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Detector Element Physical Size.
	 * @return String - value of Detector Element Physical Size.
	 */
	public String getDetectorElementPhysicalSize()
	{
		Object objValue = getValue(0x0018,0x7020);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets DetectorElementSpacing.Uniquely identifies DetectorElementSpacing.
	 * @param strDetectorElementSpacing String value of Detector Temperature.
	 */
	public void setDetectorElementSpacing(String strDetectorElementSpacing)
	{
		/* Accept the DetectorElementSpacing in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x7022, strDetectorElementSpacing,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x7022,DicomConstants.DCM_DT_DS, strDetectorElementSpacing);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Detector Detector Element Spacing.
	 * @return String - value of Detector Detector Element Spacing.
	 */
	public String getDetectorElementSpacing()
	{
		Object objValue = getValue(0x0018,0x7022);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets the Detector Active Shape Defined in Terms of TEXT,NUMERIC,CODE,DATE,TIME,PNAME
	 * @param strDetectorActiveShape Specifies type of the value encoded in this Item
	 */
	public void setDetectorActiveShape(EnumDetectorActiveShape enumDetectorActiveShape)
	{
		/* Accept the Detector Active Shape in String format of type CS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x7024, enumDetectorActiveShape,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x7024,DicomConstants.DCM_DT_CS, enumDetectorActiveShape);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves type of the value encoded in this Item
	 * @return String - Type of the value encoded in this Item
	 */
	public String getDetectorActiveShape()
	{
		Object objValue = getValue(0x0018,0x7024);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * Sets Detector Active Dimensions.Uniquely identifies Detector Active Dimensions
	 * @param strDetectorActiveDimensions String value of Detector Active Dimensions.
	 */
	public void setDetectorActiveDimensions(String strDetectorActiveDimensions)
	{
		/*Accept the SliceThickness in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x7026, strDetectorActiveDimensions,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x7026,DicomConstants.DCM_DT_DS, strDetectorActiveDimensions);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves DetectorActiveDimensions.
	 * @return String - value of Detector Active Dimensions.
	 */
	public String getDetectorActiveDimensions()
	{
		Object objValue = getValue(0x0018,0x7026);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets Detector Active Origin.Uniquely identifies Detector Active Origin
	 * @param strDetectorActiveOrigin String value of Detector Active Origin.
	 */
	public void setDetectorActiveOrigin(String strDetectorActiveOrigin)
	{
		/* Accept the DetectorActiveOrigin in String format of type DS.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x7028, strDetectorActiveOrigin,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0018,0x7028,DicomConstants.DCM_DT_DS, strDetectorActiveOrigin);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves DetectorActiveDimensions.
	 * @return String - value of Detector Active Dimensions.
	 */
	public String getDetectorActiveOrigin()
	{
		Object objValue = getValue(0x0018,0x7028);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * This method returns the Exposure Index Macro with proper initialization.
	 * @return - instance of {@link ExposureIndexMacro} 
	 */
	public ExposureIndexMacro getExposureIndexMacro()
	{
		if(objExposureIndexMacro == null)
		{
			if(iMacroLevel == DicomConstants.DCM_MODULE_LEVEL_MACRO)
				objExposureIndexMacro = new ExposureIndexMacro(objIDataSet);
			else 
				objExposureIndexMacro = new ExposureIndexMacro(objIItem);

			return objExposureIndexMacro;
		}
		return objExposureIndexMacro;
	}
	
}
