/*******************************************************************************
 *  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.dicommodel.modules;



import cdac.medinfo.sdk.dcm30_04.baselibs.DicomV3Factory;
import cdac.medinfo.sdk.dcm30_04.baselibs.GeneralAnatomyOptionalMacro;
import cdac.medinfo.sdk.dcm30_04.baselibs.OptionalViewandSliceProgressionDirectionMacro;
import cdac.medinfo.sdk.dcm30_04.baselibs.ReferencedCurveSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.ReferencedOverlaySequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.Tag;
import cdac.medinfo.sdk.dcm30_04.baselibs.ViewCodeSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.ViewCodeSequenceItem;
import cdac.medinfo.sdk.dcm30_04.baselibs.ViewModifierCodeSequence;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataElement;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataSet;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDicomValue;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IItem;
import cdac.medinfo.sdk.dcm30_04.commoninterface.ITag;
import cdac.medinfo.sdk.dcm30_04.enums.EnumBeatRejectionFlag;
import cdac.medinfo.sdk.dcm30_04.enums.EnumBitsAllocated;
import cdac.medinfo.sdk.dcm30_04.enums.EnumBitsStored;
import cdac.medinfo.sdk.dcm30_04.enums.EnumDecayCorrection;
import cdac.medinfo.sdk.dcm30_04.enums.EnumHighBit;
import cdac.medinfo.sdk.dcm30_04.enums.EnumLossyImageCompression;
import cdac.medinfo.sdk.dcm30_04.enums.EnumPhotometricInterpretation;
import cdac.medinfo.sdk.dcm30_04.enums.EnumSamplesPerPixel;
import cdac.medinfo.sdk.dcm30_04.enums.EnumSeriesType;
import cdac.medinfo.sdk.dcm30_04.enums.EnumSliceProgressionDirection;

import cdac.medinfo.sdk.dcm30_04.exceptions.ConditionFailedException;
import cdac.medinfo.sdk.dcm30_04.exceptions.InvalidModuleException;
import cdac.medinfo.sdk.dcm30_04.exceptions.ItemLimitException;
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;
import cdac.medinfo.sdk.dcm30_04.utils.ICollectionIterator;
import cdac.medinfo.sdk.dcm30_04.utils.ISingleCollection;
import cdac.medinfo.sdk.dcm30_04.utils.SingleCollection;

// TODO: Auto-generated Javadoc
/**
 \* This module describes the attributes in PET Image Module.
 */
public class PETImageModule extends Module  
{


	/**
	 * The obj single collection.
	 */
	public static ISingleCollection<ITag> objSingleCollection = null;

	/**
	 * The obj general anatomy optional macro.
	 */
	GeneralAnatomyOptionalMacro objGeneralAnatomyOptionalMacro = null;
	/**
	 * The obj Optional View and Slice Progression Direction Macro.
	 */
	OptionalViewandSliceProgressionDirectionMacro objOptionalViewandSliceProgressionDirectionMacro = null;
	
	/**
	 * Creates PET Image Module with default initialization.
	 * 
	 * @param objIDataSet the obj i data set
	 */
	public PETImageModule(IDataSet objIDataSet)
	{
		super(objIDataSet);
	}

	static
	{
		objSingleCollection = new SingleCollection<ITag>();
		objSingleCollection.add(new Tag(0x0008,0x0008));
		objSingleCollection.add(new Tag(0x0008,0x0022));
		objSingleCollection.add(new Tag(0x0008,0x0032));
		objSingleCollection.add(new Tag(0x0008,0x1130));
		objSingleCollection.add(new Tag(0x0008,0x1145));
		objSingleCollection.add(new Tag(0x0018,0x1060));
		objSingleCollection.add(new Tag(0x0018,0x1062));
		objSingleCollection.add(new Tag(0x0018,0x1063));
		objSingleCollection.add(new Tag(0x0018,0x1081));
		objSingleCollection.add(new Tag(0x0018,0x1082));
		objSingleCollection.add(new Tag(0x0018,0x1083));
		objSingleCollection.add(new Tag(0x0018,0x1084));
		objSingleCollection.add(new Tag(0x0018,0x1242));
		objSingleCollection.add(new Tag(0x0028,0x0002));
		objSingleCollection.add(new Tag(0x0028,0x0004));
		objSingleCollection.add(new Tag(0x0028,0x0100));
		objSingleCollection.add(new Tag(0x0028,0x0101));
		objSingleCollection.add(new Tag(0x0028,0x0102));
		objSingleCollection.add(new Tag(0x0028,0x1052));
		objSingleCollection.add(new Tag(0x0028,0x1053));
		objSingleCollection.add(new Tag(0x0028,0x2110));
		objSingleCollection.add(new Tag(0x0054,0x0220));
		objSingleCollection.add(new Tag(0x0054,0x0500));
		objSingleCollection.add(new Tag(0x0054,0x1300));
		objSingleCollection.add(new Tag(0x0054,0x1310));
		objSingleCollection.add(new Tag(0x0054,0x1311));
		objSingleCollection.add(new Tag(0x0054,0x1320));
		objSingleCollection.add(new Tag(0x0054,0x1321));
		objSingleCollection.add(new Tag(0x0054,0x1322));
		objSingleCollection.add(new Tag(0x0054,0x1323));
		objSingleCollection.add(new Tag(0x0054,0x1324));
		objSingleCollection.add(new Tag(0x0054,0x1330));
	}

	/**
	 * This method validates each Attribute in the Module according to the Type
	 * of the Attribute.Attributes are of 5 types.
	 * Type 1,Type 2 are Mandatory:
	 * Mandatory Attributes have to present in the Module.
	 * Type 1C,2C are Conditional:
	 * Conditional Attributes' presence depend on a condition.
	 * If the condition is satisfied the Attribute has to be present.
	 * Type 3 are Optional
	 * Optional Attributes can be added as and when required.
	 * 
	 * @return boolean - returns validation status as success or failure
	 * 
	 * @throws InvalidModuleException - If validation of Module fails
	 */
	public  boolean validateModule() throws InvalidModuleException
	{

		try
		{
			/*
			 * Validation Rules for Mandatory Elements
			 */
			getGeneralAnatomyOptionalMacro().validate();
			if(!isPresent(0x0008,0x0008))
				throw new MandatoryMissingException("0008,0008");
			if(!isPresent(0x0028,0x0002))
				throw new MandatoryMissingException("0028,0002");
			if(!isPresent(0x0028,0x0004))
				throw new MandatoryMissingException("0028,0004");
			if(!isPresent(0x0028,0x0100))
				throw new MandatoryMissingException("0028,0100");
			if(!isPresent(0x0028,0x0101))
				throw new MandatoryMissingException("0028,0101");
			if(!isPresent(0x0028,0x0102))
				throw new MandatoryMissingException("0028,0102");
			if(!isPresent(0x0028,0x1052))
				throw new MandatoryMissingException("0028,1052");
			if(!isPresent(0x0028,0x1053))
				throw new MandatoryMissingException("0028,1053");
			if(!isPresent(0x0054,0x1300))
				throw new MandatoryMissingException("0054,1300");
			if(!isPresent(0x0054,0x1330))
				throw new MandatoryMissingException("0054,1330");
			if(!isPresent(0x0008,0x0022))
				throw new MandatoryMissingException("0008,0022");
			if(!isPresent(0x0008,0x0032))
				throw new MandatoryMissingException("0008,0032");
			if(!isPresent(0x0018,0x1242))
				throw new MandatoryMissingException("0018,1242");

			PETSeriesModule objPETSeriesModule = new PETSeriesModule(objIDataSet);

			PETMultiGatedAcquisitionModule objPETMultiGatedAcquisitionModule = new PETMultiGatedAcquisitionModule(objIDataSet);

			String[] strSeriesType = objPETSeriesModule.getSeriesType();
			if(strSeriesType != null)
			{
				if(strSeriesType[0].equalsIgnoreCase(EnumSeriesType.Value1.GATED.getValue()))
				{
					if(!isPresent(0x0018,0x1060))
						throw new ConditionFailedException("0018,1060 is required if Series Type (0054,1000), Value 1 is GATED.");
					if(!isPresent(0x0018,0x1063))
						throw new ConditionFailedException("0018,1063 is required if Series Type (0054,1000), Value 1 is GATED.");

					String strBeatRejectionFlag = objPETMultiGatedAcquisitionModule.getBeatRejectionFlag();
					if(strBeatRejectionFlag != null)
					{
						if(strBeatRejectionFlag.equalsIgnoreCase(EnumBeatRejectionFlag.YES.getValue()) && !isPresent(0x0018,0x1081))
							throw new ConditionFailedException("0018,1081 is required if Series Type (0054,1000), Value 1 is GATED and Beat Rejection Flag (0018,1080) is Y");
						if(strBeatRejectionFlag.equalsIgnoreCase(EnumBeatRejectionFlag.YES.getValue()) && !isPresent(0x0018,0x1082))
							throw new ConditionFailedException("0018,1082 is required if Series Type (0054,1000), Value 1 is GATED and Beat Rejection Flag (0018,1080) is Y");
					}
				}
			}
			String strDecayCorrection = objPETSeriesModule.getDecayCorrection();
			if(strDecayCorrection != null)
			{
				if(!strDecayCorrection.equalsIgnoreCase(EnumDecayCorrection.NO_DECAY_CORRECTION.getValue()) && !isPresent(0x0054,0x1321))
					throw new ConditionFailedException("0054,1321 Required if Decay Correction (0054,1102) is other than NONE");
			}
			String strTSUID = getTransferSyntax().getTransferSyntaxUID();
			if(strTSUID.equalsIgnoreCase(DicomConstants.TS_LOSSY_JPEG_12_BIT) || strTSUID.equalsIgnoreCase(DicomConstants.TS_LOSSY_JPEG_8_BIT))
			{
				if(!isPresent(0x0028,0x2110))
					throw new ConditionFailedException("Lossy Image Compression(0028,2110) is required if Lossy Compression has been performed on the Image");
			}

			if(isPresent(0x0008,0x1130))
				getReferencedOverlaySequence().validateForModule();
			if(isPresent(0x0008,0x1145))
				getReferencedCurveSequence().validateForModule();
			if(isPresent(0x0054,0x0220))
			{
				ViewCodeSequence objViewCodeSequence = getViewCodeSequence();
				objViewCodeSequence.validateForModule();
				ICollectionIterator<IItem> objViewCodeSequenceIterator = objViewCodeSequence.iterator();
				ViewCodeSequenceItem objViewCodeSequenceItem = null;
				while(objViewCodeSequenceIterator.hasNext())
				{
					objViewCodeSequenceItem = (ViewCodeSequenceItem)objViewCodeSequenceIterator.next();
					if(objViewCodeSequenceItem.contains(0x0054,0x0222))
					{
						ViewModifierCodeSequence objViewModifierCodeSequence = objViewCodeSequenceItem.getViewModifierCodeSequence();
						int iNoOfItems = objViewModifierCodeSequence.noOfItems();
						if(iNoOfItems > 1)
							throw new ItemLimitException("0054,0222 shall contain Single Item");
						objViewModifierCodeSequence.validateForModule();
					}
				}
				/*
				 * Condition for View Modifier Code Sequence(0054,0222) in View Code Sequence(0054,0220) for this Module is not clear.
				 * Condition :- Required if needed to fully specify the View.
				 * refer pdf 3 page no. 547.
				 */
			}


		}
		catch(MandatoryMissingException mme)
		{
			if(DicomConfig.createInstance().isLoggingOn())
				DicomLogger.getLogger().log(mme.getMessage());

			
				throw new InvalidModuleException(this.getClass().getSimpleName(),mme);

		}
		catch(ConditionFailedException cfe)
		{
			if(DicomConfig.createInstance().isLoggingOn())
				DicomLogger.getLogger().log(cfe.getMessage());

			
				throw new InvalidModuleException(this.getClass().getSimpleName(),cfe);

		}
		return true;
	}

	/**
	 * Sets Image identification characteristics.
	 * 
	 * @param arrStrImageType String array of Image identification characteristics.
	 */	
	public void setImageType(String[] arrStrImageType)
	{
		/*Accept Image identification characteristics in String Array format of type CS.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0008, 0x0008, DicomConstants.DCM_DT_CS, arrStrImageType);
	}

	/**
	 * Return Image Type.
	 * 
	 * @return String[]- String array of Image identification characteristics.
	 */
	public String[] getImageType()
	{
		if (objIDataSet == null)
			return null;
		IDataElement objIDataElement =  objIDataSet.getDataForTag(0x0008,0x0008);
		if(objIDataElement == null)
			return null;
		IDicomValue objIDicomValue = objIDataElement.getDicomValue();
		if(objIDicomValue == null)
			return null;
		if(objIDicomValue.getValue()==null)
			return null;
		return (String[])objIDicomValue.getValue();
	}

	/**
	 * Sets Samples per Pixel (0028,0002) is the number of separate planes in the image. One, three, and
	 * four image planes are defined. For monochrome (gray scale) and palette color images, the number of planes is 1. For RGB and
	 * other three vector color models, the value of this attribute is 3. For four vector color models, the
	 * value of this attribute is 4.
	 * 
	 * @param enumSamplesPerPixel specifies the samples per pixel in the image
	 */
	public void setSamplesPerPixel(EnumSamplesPerPixel enumSamplesPerPixel)
	{
		/*Accept Number of samples (planes) in this image in short format of type US.
		 * 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
		 */
		addDataElement(0x0028, 0x0002, DicomConstants.DCM_DT_US, enumSamplesPerPixel.getValue());
	}

	/**
	 * Retrieves the samples per pixel.
	 * 
	 * @return Short - returns the samples per pixel
	 */
	public short getSamplesPerPixel()
	{
		Object objectValue = getValue(0x0028,0x0002);
		if(objectValue!=null)
			return Short.parseShort(objectValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}

	/**
	 * Sets the intended interpretation of the pixel data.
	 * 
	 * @param enumPhotometricInterpretation Enum value of Photometric Interpretation
	 */
	public void setPhotometricInterpretation(EnumPhotometricInterpretation enumPhotometricInterpretation)
	{
		/*Accept Specifies the intended interpretation of the pixel data in String format of type ST.
		 * 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
		 */
		addDataElement(0x0028, 0x0004, DicomConstants.DCM_DT_CS, enumPhotometricInterpretation.getValue());
	}

	/**
	 * Retrieves the photometric interpretation.
	 * 
	 * @return String - returns the photometric interpretation
	 */
	public String getPhotometricInterpretation()
	{
		Object objectValue = getValue(0x0028, 0x0004);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets Number of bits allocated for each pixel sample. Each sample shall have the same
	 * number of bits allocated.
	 * 
	 * @param enumBitsAllocated specifies the number of bits allocated
	 */
	public void setBitsAllocated(EnumBitsAllocated enumBitsAllocated)
	{
		/*Accept bits allocated for each pixel in this image in short format of type US.
		 * 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
		 */
		addDataElement(0x0028, 0x0100, DicomConstants.DCM_DT_US, enumBitsAllocated.getValue());
	}

	/**
	 * Retrieves the number of bits allocated.
	 * 
	 * @return Short - returns the number of bits allocated
	 */
	public short getBitsAllocated()
	{
		Object objectValue = getValue(0x0028, 0x0100);
		if(objectValue!=null)
			return Short.parseShort(objectValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}

	/**
	 * Sets Number of bits stored for each pixel sample. Each sample shall have the same
	 * number of bits stored.
	 * 
	 * @param enumBitsStored specifies the number of bits stored
	 */
	public void setBitsStored(EnumBitsStored enumBitsStored)
	{
		/*Accept bits stored for each pixel in this image in short format of type US.
		 * 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
		 */
		addDataElement(0x0028, 0x0101, DicomConstants.DCM_DT_US, enumBitsStored.getValue());
	}

	/**
	 * Retrieves the number of bits stored.
	 * 
	 * @return Short - returns the number of bits stored
	 */
	public short getBitsStored()
	{
		Object objectValue = getValue(0x0028, 0x0101);
		if(objectValue!=null)
			return Short.parseShort(objectValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}

	/**
	 * Sets Most significant bit for pixel sample data. Each sample shall have the same high bit.
	 * 
	 * @param enumHighBit specifies the high bit
	 */
	public void setHighBit(EnumHighBit enumHighBit)
	{
		/*Accept Most significant bit for pixel in this image in short format of type US.
		 * 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
		 */
		addDataElement(0x0028, 0x0102, DicomConstants.DCM_DT_US, enumHighBit.getValue());
	}

	/**
	 * Retrieves the high bit.
	 * 
	 * @return Short - returns the high bit
	 */
	public short getHighBit()
	{
		Object objectValue = getValue(0x0028, 0x0102);
		if(objectValue!=null)
			return Short.parseShort(objectValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}

	/**
	 * The value b in relationship between stored values (SV) and the output units
	 * specified in Rescale Type (0028,1054). Output units = m*SV + b. Required if Modality LUT Sequence
	 * (0028,3000) is not present. Shall not be present otherwise.
	 * 
	 * @param strRescaleIntercept String value of Rescale Intercept.
	 */
	public void setRescaleIntercept(String strRescaleIntercept)
	{
		/*Accept Rescale Intercept 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 Hash Map
		 */
		addDataElement(0x0028, 0x1052, DicomConstants.DCM_DT_DS, strRescaleIntercept);
	}

	/**
	 * Retrieves Rescale Intercept.
	 * 
	 * @return String - String value of Rescale Intercept.
	 */
	public String getRescaleIntercept()
	{Object objectValue = getValue(0x0028,0x1052);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets m in the equation specified by Rescale Intercept (0028,1052). Required if Rescale Intercept is present.
	 * 
	 * @param strRescaleSlope String value of Rescale Scope.
	 */
	public void setRescaleSlope(String strRescaleSlope)
	{
		/*Accept Rescale Slope 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 Hash Map
		 */
		addDataElement(0x0028, 0x1053, DicomConstants.DCM_DT_DS, strRescaleSlope);
	}

	/**
	 * Retrieves Rescale Scope.
	 * 
	 * @return String - String value of Rescale Scope.
	 */
	public String getRescaleSlope()
	{Object objectValue = getValue(0x0028,0x1053);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets The time that the pixel values in the image occurred.
	 * Frame Reference Time is the offset, in msec, from the Series reference time.
	 * 
	 * @param strFrameReferenceTime String value of Frame Reference Time.
	 */
	public void setFrameReferenceTime(String strFrameReferenceTime)
	{
		/*Accept Rescale Slope 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 Hash Map
		 */
		addDataElement(0x0054,0x1300, DicomConstants.DCM_DT_DS, strFrameReferenceTime);
	}

	/**
	 * Retrieves The time that the pixel values in the image occurred.
	 * 
	 * @return String - String value of Frame Reference Time.
	 */
	public String getFrameReferenceTime()
	{Object objectValue = getValue(0x0054,0x1300);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets Time interval, in msec, from the start of the trigger to the beginning of data acquisition
	 * for this image.
	 * 
	 * @param strTriggerTime String value of Trigger Time
	 */
	public void setTriggerTime(String strTriggerTime)
	{
		/*Accept TriggerTime in String format.
		 * 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 Hash Map
		 */
		addDataElement(0x0018, 0x1060, DicomConstants.DCM_DT_DS, strTriggerTime);
	}

	/**
	 * Retrieves Time interval, in msec, from the start of the trigger to the beginning of data acquisition for this image.
	 * 
	 * @return String - String value of Trigger Time.
	 */
	public String getTriggerTime()
	{
		Object objectValue = getValue(0x0018, 0x1060);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets Nominal duration per individual frame, in msec.Required if Series Type (0054,1000), Value 1 is GATED.
	 * 
	 * @param strFrameTime String value of Frame Time
	 */
	public void setFrameTime(String strFrameTime)
	{
		/* Accept Frame Time in String format.
		 * 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 Hash Map
		 */
		addDataElement(0x0018, 0x1063, DicomConstants.DCM_DT_DS, strFrameTime);
	}

	/**
	 * Retrieves Nominal duration per individual frame, in msec.
	 * 
	 * @return String - String value of Frame Time.
	 */
	public String getFrameTime()
	{
		Object objectValue = getValue(0x0018, 0x1063);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets R-R interval lower limit for beat rejection, in msec.
	 * 
	 * @param strLowRRValue R-R interval low limit for beat rejection, in msec
	 */
	public void setLowRRValue(String strLowRRValue)
	{
		/*Accept Low R-R Value 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 Hash Map
		 */
		addDataElement(0x0018, 0x1081, DicomConstants.DCM_DT_IS, strLowRRValue);
	}

	/**
	 * Return R-R interval low limit for beat rejection, in msec.
	 * 
	 * @return String - String value of Low RR Value.
	 */
	public String getLowRRValue()
	{
		IDataElement objIDataElement = objIDataSet.getDataForTag(0x0018, 0x1081);
		if(objIDataElement == null)
			return null;
		IDicomValue objIDicomValue = objIDataElement.getDicomValue();
		if(objIDicomValue == null)
			return null;
		if(objIDicomValue.getValue() == null)
			return null;
		return objIDicomValue.getValue().toString();
	}

	/**
	 * Sets R-R interval upper limit for beat rejection, in msec.
	 * 
	 * @param strHighRRValue R-R interval high limit for beat rejection, in msec
	 */
	public void setHighRRValue(String strHighRRValue)
	{
		/*Accept High R-R Value 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 Hash Map
		 */
		addDataElement(0x0018, 0x1082, DicomConstants.DCM_DT_IS, strHighRRValue);
	}

	/**
	 * Return R-R interval high limit for beat rejection, in msec.
	 * 
	 * @return String - String value of High RR Value.
	 */
	public String getHighRRValue()
	{
		IDataElement objIDataElement = objIDataSet.getDataForTag(0x0018, 0x1082);
		if(objIDataElement == null)
			return null;
		IDicomValue objIDicomValue = objIDataElement.getDicomValue();
		if(objIDicomValue == null)
			return null;
		if(objIDicomValue.getValue() == null)
			return null;
		return objIDicomValue.getValue().toString();
	}

	/**
	 * Specifies whether an Image has undergone lossy compression.
	 * Enumerated Values: 00 = Image has NOT been subjected to lossy compression,
	 * 01 = Image has been subjected to lossy compression.
	 * 
	 * @param enumLossyImageCompression Enum value of Lossy Image Compression.
	 */
	public void setLossyImageCompression(EnumLossyImageCompression enumLossyImageCompression)
	{
		/*Accept Specifies whether an Image has undergone lossy compression.
		 * 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 Hash Map
		 */
		addDataElement(0x0028, 0x2110, DicomConstants.DCM_DT_CS, enumLossyImageCompression.getValue());
	}

	/**
	 * Return whether an Image has undergone lossy compression.
	 * 
	 * @return String - String value of Lossy Image Compression.
	 */
	public String getLossyImageCompression()
	{
		Object objectValue = getValue(0x0028, 0x2110);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets An index identifying the position of this image within a PET Series.
	 * 
	 * @param shImageIndex short value of an Index identifying the position of this image within a PET Series.
	 */
	public void setImageIndex(short shImageIndex)
	{
		/* Accept Image Index String format of type US.
		 * 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
		 */
		addDataElement(0x0054, 0x1330, DicomConstants.DCM_DT_US, shImageIndex);
	}

	/**
	 * Return An index identifying the position of this image within a PET Series.
	 * 
	 * @return String - String value of Image Index.
	 */
	public short getImageIndex()
	{Object objectValue = getValue(0x0054, 0x1330);
		if(objectValue!=null)
			return Short.parseShort(objectValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}

	/**
	 * Sets The date the acquisition of data that resulted in this image started.
	 * 
	 * @param strAcquisitionDate String value of Acquisition Date
	 */
	public void setAcquisitionDate(String strAcquisitionDate)
	{
		/* Accept The date the acquisition of data that resulted in this image started in String format 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 Hash Map
		 */
		addDataElement(0x0008, 0x0022, DicomConstants.DCM_DT_DA, strAcquisitionDate);
	}

	/**
	 * Retrieves the Date the acquisition of data that resulted in this image started.
	 * 
	 * @return String - the Date of Acquisition
	 */
	public String getAcquisitionDate()
	{
		Object objectValue = getValue(0x0008, 0x0022);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets The time the acquisition of data that resulted in this image started.
	 * 
	 * @param strAcquisitionTime String value of Acquisition Time
	 */
	public void setAcquisitionTime(String strAcquisitionTime)
	{
		/*Accept The Time the acquisition of data that resulted in this image started in String format 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 Hash Map
		 */
		addDataElement(0x0008, 0x0032, DicomConstants.DCM_DT_TM, strAcquisitionTime);
	}

	/**
	 * Retrieves the time the acquisition of data that resulted in this image started.
	 * 
	 * @return String - String value of  Time of Acquisition
	 */
	public String getAcquisitionTime()
	{
		Object objectValue = getValue(0x0008, 0x0032);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets elapsed time of data acquisition in msec per each frame.
	 * 
	 * @param strActualFrameDuration String value of Actual Frame Duration.
	 */
	public void setActualFrameDuration(String strActualFrameDuration)
	{
		/*Accept Actual Frame Duration in String format of type IS.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0018, 0x1242, DicomConstants.DCM_DT_IS, strActualFrameDuration);
	}

	/**
	 * Retrieves Elapsed time of data acquisition in msec per each frame.
	 * 
	 * @return String - String value of Actual Frame Duration.
	 */
	public String getActualFrameDuration()
	{Object objectValue = getValue(0x0018,0x1242);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets Average duration of accepted beats, in msec, of the R-R interval.
	 * 
	 * @param strNominalInterval String value of Average duration of accepted beats, in msec, of the R-R interval.
	 */
	public void setNominalInterval(String strNominalInterval)
	{
		/*Accept Nominal Interval 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 Hash Map
		 */
		addDataElement(0x0018, 0x1062, DicomConstants.DCM_DT_IS, strNominalInterval);
	}

	/**
	 * Retrieves  Average duration of accepted beats, in msec, of the R-R interval.
	 * 
	 * @return String - String value of Nominal Interval.
	 */
	public String getNominalInterval()
	{
		Object objectValue = getValue(0x0018, 0x1062);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets Number of heartbeats that fall within Low R-R Value (0018,1081) and High R-R Value (0018,1082), and were therefore
	 * accepted and contribute coincidence events to this R-R Interval.
	 * 
	 * @param strIntervalsAcquired String value of Intervals Acquired
	 */
	public void setIntervalsAcquired(String strIntervalsAcquired)
	{
		/*Accept Intervals Acquired 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 Hash Map
		 */
		addDataElement(0x0018, 0x1083, DicomConstants.DCM_DT_IS, strIntervalsAcquired);
	}

	/**
	 * Return Intervals Acquired.
	 * 
	 * @return String - String value of Intervals Acquired.
	 */
	public String getIntervalsAcquired()
	{
		Object objectValue = getValue(0x0018, 0x1083);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets Number of heartbeats that fall outside Low R-R Value (0018,1081) and High R-R
	 * Value (0018,1082), and do not contribute coincidence events to this R-R Interval.
	 * However, they may contribute coincidence events to other R-R Intervals.
	 * 
	 * @param strIntervalsRejected String value of Number of R-R intervals Rejected.
	 */
	public void setIntervalsRejected(String strIntervalsRejected)
	{
		/*Accept Intervals Rejected 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 Hash Map
		 */
		addDataElement(0x0018, 0x1084, DicomConstants.DCM_DT_IS, strIntervalsRejected);
	}

	/**
	 * Return Number of R-R intervals Rejected.
	 * 
	 * @return String - String value of Intervals Rejected.
	 */
	public String getIntervalsRejected()
	{
		Object objectValue = getValue(0x0018, 0x1084);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets The sum of events that occur in the primary event channel. The counts include Trues +Scatter+ Randoms if Randoms Correction Method (0054,1100) is NONE; otherwise the counts are Trues +Scatter.
	 * 
	 * @param strPrimaryCountsAccumulated String value of Number of Primary Counts Accumulated.
	 */
	public void setPrimaryCountsAccumulated(String strPrimaryCountsAccumulated)
	{
		/*Accept Primary Counts Accumulated 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 Hash Map
		 */
		addDataElement(0x0054, 0x1310, DicomConstants.DCM_DT_IS, strPrimaryCountsAccumulated);
	}

	/**
	 * Return Primary Counts Accumulated.
	 * 
	 * @return String - String value of Primary Counts Accumulated.
	 */
	public String getPrimaryCountsAccumulated()
	{
		Object objectValue = getValue(0x0054, 0x1310);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets Sum of counts accumulated in secondary channels.
	 * 
	 * @param strArrSecondaryCountsAccumulated String array of Number of Secondary Counts Accumulated.
	 */
	public void setSecondaryCountsAccumulated(String[] strArrSecondaryCountsAccumulated)
	{
		/*Accept Secondary Counts Accumulated 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 Hash Map
		 */
		addDataElement(0x0054, 0x1311, DicomConstants.DCM_DT_IS, strArrSecondaryCountsAccumulated);
	}

	/**
	 * Return Secondary Counts Accumulated.
	 * 
	 * @return String[] - String array of Secondary Counts Accumulated.
	 */
	public String[] getSecondaryCountsAccumulated()
	{
		Object objectValue = getValue(0x0054, 0x1311);
		if(objectValue!=null)
			return (String[])objectValue;
		return null;
	}

	/**
	 * Sets The slice-to-slice sensitivity correction factor that was used to correct this image.
	 * The value shall be one if no slice sensitivity correction was applied.
	 * 
	 * @param strSliceSensitivityFactor String value of Slice Sensitivity Factor.
	 */
	public void setSliceSensitivityFactor(String strSliceSensitivityFactor)
	{
		/*Accept Slice Sensitivity Factor 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 Hash Map
		 */
		addDataElement(0x0054, 0x1320, DicomConstants.DCM_DT_DS, strSliceSensitivityFactor);
	}

	/**
	 * Return The slice-to-slice sensitivity correction factor that was used to correct this image.
	 * 
	 * @return String - String value of Slice Sensitivity Factor.
	 */
	public String getSliceSensitivityFactor()
	{
		Object objectValue = getValue(0x0054, 0x1320);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets The decay factor that was used to scale this image. Required if Decay Correction (0054,1102) is other than NONE.
	 * If decay correction is applied, all images in the Series shall be decay corrected to the same time.
	 * 
	 * @param strDecayFactor String value of Decay Factor.
	 */
	public void setDecayFactor(String strDecayFactor)
	{
		/* Accept Decay Factor 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 Hash Map
		 */
		addDataElement(0x0054, 0x1321, DicomConstants.DCM_DT_DS, strDecayFactor);
	}

	/**
	 * Return The decay factor that was used to scale this image.
	 * 
	 * @return String - String value of Decay Factor.
	 */
	public String getDecayFactor()
	{
		Object objectValue = getValue(0x0054, 0x1321);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets Factor that was used to scale this image from counts/sec to Bq/ml using a dose calibrator.
	 * The value shall be one if no dose calibration was applied.
	 * 
	 * @param strDoseCalibrationFactor String value of Dose Calibration Factor.
	 */
	public void setDoseCalibrationFactor(String strDoseCalibrationFactor)
	{
		/* Accept Dose Calibration Factor 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 Hash Map
		 */
		addDataElement(0x0054, 0x1322, DicomConstants.DCM_DT_DS, strDoseCalibrationFactor);
	}

	/**
	 * Return Factor that was used to scale this image from counts/sec to Bq/ml using a dose calibrator.
	 * 
	 * @return String - String value of Dose Calibration Factor.
	 */
	public String getDoseCalibrationFactor()
	{
		Object objectValue = getValue(0x0054, 0x1322);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets An estimate of the fraction of acquired counts that were due to scatter and were corrected in this image.
	 * The value shall be zero if no scatter correction was applied.
	 * 
	 * @param strScatterFractionFactor String value of Scatter Fraction Factor.
	 */
	public void setScatterFractionFactor(String strScatterFractionFactor)
	{
		/* Accept Dose Calibration Factor 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 Hash Map
		 */
		addDataElement(0x0054, 0x1323, DicomConstants.DCM_DT_DS, strScatterFractionFactor);
	}

	/**
	 * Return an estimate of the fraction of acquired counts that were due to scatter and were corrected in this image.
	 * 
	 * @return String - String value of Scatter Fraction Factor.
	 */
	public String getScatterFractionFactor()
	{
		Object objectValue = getValue(0x0054, 0x1323);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets The average dead time correction factor that was applied to this image.
	 * The value shall be one if no dead time correction was applied.
	 * 
	 * @param strDeadTimeFactor String value of Dead Time Factor.
	 */
	public void setDeadTimeFactor(String strDeadTimeFactor)
	{
		/* Accept Dead Time Factor 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 Hash Map
		 */
		addDataElement(0x0054, 0x1324, DicomConstants.DCM_DT_DS, strDeadTimeFactor);
	}

	/**
	 * Return The average dead time correction factor that was applied to this image.
	 * 
	 * @return String - String value of Dead Time Factor.
	 */
	public String getDeadTimeFactor()
	{
		Object objectValue = getValue(0x0054, 0x1324);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Returns a sequence which provides reference to a set of SOP Class/Instance pairs which are related independent Overlays. Uniquely
	 * identifies Overlays significantly related toth is Image. Zero or more Items may be included in this sequence.
	 * 
	 * @return - instance of ReferencedOverlaySequence.
	 */
	public ReferencedOverlaySequence getReferencedOverlaySequence()
	{
		ReferencedOverlaySequence objReferencedOverlaySequence = (ReferencedOverlaySequence)getDicomValue(0x0008, 0x1130);
		if(objReferencedOverlaySequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objReferencedOverlaySequence = (ReferencedOverlaySequence)objDicomV3Factory.createSequence(0x0008, 0x1130, objITransferSyntax, objIDictionaryReader);
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0008, 0x1130, DicomConstants.DCM_DT_SQ, objReferencedOverlaySequence.getValue());
		}
		return objReferencedOverlaySequence;
	}	

	/**
	 * Returns a sequence which provides reference to a set of SOP Class/Instance pairs which are
	 * related independent Curves. Uniquely identifies Curves significantly related to this
	 * Image. Zero or more Items may be included in this sequence.
	 * 
	 * @return - intance of ReferencedCurveSequence.
	 */
	public ReferencedCurveSequence getReferencedCurveSequence()
	{
		ReferencedCurveSequence objReferencedCurveSequence = (ReferencedCurveSequence)getDicomValue(0x0008, 0x1145);
		if(objReferencedCurveSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objReferencedCurveSequence = (ReferencedCurveSequence)objDicomV3Factory.createSequence(0x0008, 0x1145, objITransferSyntax, objIDictionaryReader);
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0008, 0x1145, DicomConstants.DCM_DT_SQ, objReferencedCurveSequence.getValue());
		}
		return objReferencedCurveSequence;
	}	

	/**
	 * Retrieves the instance of GeneralAnatomyOptionalMacro. If the instance is not already present a new instance
	 * is created and returned. It is used to set the attribtues of GeneralAnatomyOptionalMacro in CR Image Module.
	 * 
	 * @return - instance of GeneralAnatomyOptionalMacro.
	 */
	public GeneralAnatomyOptionalMacro getGeneralAnatomyOptionalMacro()
	{
		if(objGeneralAnatomyOptionalMacro == null)
		{
			objGeneralAnatomyOptionalMacro = new GeneralAnatomyOptionalMacro(objIDataSet);
			return objGeneralAnatomyOptionalMacro;
		}
		return objGeneralAnatomyOptionalMacro;
	}

	
	/**
	 * Retrieves the instance of OptionalViewandSliceProgressionDirectionMacro. If the instance is not already present a new instance
	 * is created and returned. It is used to set the attribtues of OptionalViewandSliceProgressionDirectionMacro in CR Image Module.
	 * 
	 * @return - instance of GeneralAnatomyOptionalMacro.
	 */
	public OptionalViewandSliceProgressionDirectionMacro getOptionalViewandSliceProgressionDirectionMacro()
	{
		if(objOptionalViewandSliceProgressionDirectionMacro == null)
		{
			objOptionalViewandSliceProgressionDirectionMacro = new OptionalViewandSliceProgressionDirectionMacro(objIDataSet);
			return objOptionalViewandSliceProgressionDirectionMacro;
		}
		return objOptionalViewandSliceProgressionDirectionMacro;
	}

	/**
	 * Sets Slice Thickness.Uniquely identifies Slice Thickness(0018,0050) in Pixel Measures Sequence(0028,9110).
	 * @param strSliceThickness String value of Slice Thickness.
	 */
	public void setIsocenterPosition(String strIsocenterPosition)
	{
		/*Accept the IsocenterPosition 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
		 */
		addDataElement(0x300A,0x012C,DicomConstants.DCM_DT_DS, strIsocenterPosition);
	}
	/**
	 * Retrieves Isocenter Position.
	 * @return String - value of Isocenter Position.
	 */
	public String getIsocenterPosition()
	{
		Object objValue = getValue(0x300A,0x012C);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Describes the anatomical direction that slices are progressing as the slices are
	 * considered in order (as defined by the Slice Vector (0054,0080)). Meaningful
	 * only for cardiac images. When View Code Sequence (0054,0220) indicates a short axis view, then
	 * Enumerated Values are: APEX_TO_BASE, BASE_TO_APEX
	 * 
	 * @param enumSliceProgressionDirection - Enum values of Slice Progression Direction.
	 */
	public void setSliceProgressionDirection(EnumSliceProgressionDirection enumSliceProgressionDirection)
	{
		/*Accept Slice Progression Direction 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 DataSet
		 */
		addDataElement(0x0054, 0x0500, DicomConstants.DCM_DT_CS, enumSliceProgressionDirection.getValue());
	}

	/**
	 * Retrieves  the anatomical direction that slices are progressing as the slices are considered in order (as defined by the Slice Vector (0054,0080)).
	 * 
	 * @return String - String value of Slice Progression Direction.
	 */
	public String getSliceProgressionDirection()
	{Object objectValue = getValue(0x0054,0x0500);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Retrieves pre-initialized object of View Code Sequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence
	 * 
	 * @return ViewCodeSequence - instance of View Code Sequence.
	 */
	public ViewCodeSequence getViewCodeSequence()
	{
		ViewCodeSequence objViewCodeSequence = (ViewCodeSequence)getDicomValue(0x0054, 0x0220);
		if(objViewCodeSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objViewCodeSequence = (ViewCodeSequence)objDicomV3Factory.createSequence(0x0054, 0x0220, objITransferSyntax, objIDictionaryReader);
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0054, 0x0220, DicomConstants.DCM_DT_SQ, objViewCodeSequence.getValue());
		}
		return objViewCodeSequence;
	}

	/**
	 * This method returns the vector of keys representing the DataElements
	 * that belong to this module.
	 * 
	 * @return vector of Tags - returns the vector containing the collection of tags
	 */
	public ISingleCollection<ITag> getVectorOfKeys()
	{
		return objSingleCollection;
	}
}
