/*******************************************************************************
 *  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.Tag;
import cdac.medinfo.sdk.dcm30_04.baselibs.VOILUTSequence;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataSet;
import cdac.medinfo.sdk.dcm30_04.commoninterface.ITag;
import cdac.medinfo.sdk.dcm30_04.enums.EnumBitsAllocated;
import cdac.medinfo.sdk.dcm30_04.enums.EnumBitsStored;
import cdac.medinfo.sdk.dcm30_04.enums.EnumBurnedInAnnotation;
import cdac.medinfo.sdk.dcm30_04.enums.EnumCalibrationImage;
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.EnumPixelIntensityRelationship;
import cdac.medinfo.sdk.dcm30_04.enums.EnumPixelIntensityRelationshipSign;
import cdac.medinfo.sdk.dcm30_04.enums.EnumPixelRepresentation;
import cdac.medinfo.sdk.dcm30_04.enums.EnumPresentationIntentType;
import cdac.medinfo.sdk.dcm30_04.enums.EnumPresentationLUTShape;
import cdac.medinfo.sdk.dcm30_04.enums.EnumRescaleIntercept;
import cdac.medinfo.sdk.dcm30_04.enums.EnumRescaleScope;
import cdac.medinfo.sdk.dcm30_04.enums.EnumRescaleType;
import cdac.medinfo.sdk.dcm30_04.enums.EnumSamplesPerPixel;

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

// TODO: Auto-generated Javadoc
/**
 \* This module contains IOD Attributes that describe a DX Image by specializing Attributes of the
 * General Image and Image Pixel Modules, and adding additional Attributes.
 * 
 * 
 */
public class DXImageModule extends Module 
{


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


	/**
	 * Instantiates a new dX image module.
	 * 
	 * @param objIDataSet the obj i data set
	 */
	public DXImageModule(IDataSet objIDataSet)
	{
		super(objIDataSet);
	}
	static
	{
		objSingleCollection = new SingleCollection<ITag>();
		objSingleCollection.add(new Tag(0x0008,0x0008));
		objSingleCollection.add(new Tag(0x0008,0x2111));
		objSingleCollection.add(new Tag(0x0018,0x1400));
		objSingleCollection.add(new Tag(0x0018,0x1401));
		objSingleCollection.add(new Tag(0x0020,0x0020));
		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,0x0103));
		objSingleCollection.add(new Tag(0x0028,0x0140));
		objSingleCollection.add(new Tag(0x0028,0x0141));
		objSingleCollection.add(new Tag(0x0028,0x0152));
		objSingleCollection.add(new Tag(0x0028,0x0153));
		objSingleCollection.add(new Tag(0x0028,0x0154));
		objSingleCollection.add(new Tag(0x0028,0x0301));
		objSingleCollection.add(new Tag(0x0028,0x1050));
		objSingleCollection.add(new Tag(0x0028,0x1051));
		objSingleCollection.add(new Tag(0x0028,0x1055));
		objSingleCollection.add(new Tag(0x0028,0x2110));
		objSingleCollection.add(new Tag(0x0028,0x2112));
		objSingleCollection.add(new Tag(0x0028,0x3010));
		objSingleCollection.add(new Tag(0x0050,0x0004));
		objSingleCollection.add(new Tag(0x2050,0x0020));

	}

	/**
	 * 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 - 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
		 */
			if(!isPresent(0x0008,0x0008))
				throw new MandatoryMissingException("Missing Mandatory Element 0008,0008");
			else if(!isPresent(0x0028,0x0002))
				throw new MandatoryMissingException("Missing Mandatory Element 0028,0002");
			else if(!isPresent(0x0028,0x0004))
				throw new MandatoryMissingException("Missing Mandatory Element 0028,0004");
			else if(!isPresent(0x0028,0x0100))
				throw new MandatoryMissingException("Missing Mandatory Element 0028,0100");
			else if(!isPresent(0x0028,0x0101))
				throw new MandatoryMissingException("Missing Mandatory Element 0028,0101");
			else if(!isPresent(0x0028,0x0102))
				throw new MandatoryMissingException("Missing Mandatory Element 0028,0102");
			else if(!isPresent(0x0028,0x0103))
				throw new MandatoryMissingException("Missing Mandatory Element 0028,0103");
			else if(!isPresent(0x0028,0x1040))
				throw new MandatoryMissingException("Missing Mandatory Element 0028,1040");
			else if(!isPresent(0x0028,0x1041))
				throw new MandatoryMissingException("Missing Mandatory Element 0028,1041");
			else if(!isPresent(0x0028,0x1052))
				throw new MandatoryMissingException("Missing Mandatory Element 0028,1052");
			else if(!isPresent(0x0028,0x1053))
				throw new MandatoryMissingException("Missing Mandatory Element 0028,1053");
			else if(!isPresent(0x0028,0x1054))
				throw new MandatoryMissingException("Missing Mandatory Element 0028,1054");
			else if(!isPresent(0x2050,0x0020))
				throw new MandatoryMissingException("Missing Mandatory Element 2050,0020");
			else if(!isPresent(0x0028,0x2110))
				throw new MandatoryMissingException("Missing Mandatory Element 0028,2110");
			else if(!isPresent(0x0028,0x0301))
				throw new MandatoryMissingException("Missing Mandatory Element 0028,0301");
			else if(isPresent(0x0020,0x0020) && isPresent(0x0054,0x0220))
				throw new ConditionFailedException("Condition Failed for Element 0020,0020");
			else
			{
				if(isPresent(0x0028,0x2112) && !isPresent(0x0028,0x2110))
					throw new ConditionFailedException("Condition Failed for Element 0028,0301");

				String strValue = null;
				if(isPresent(0x0008,0x0068))
				{
					DXSeriesModule objDXSeriesModule = new DXSeriesModule(objIDataSet);
					strValue = objDXSeriesModule.getPresentationIntentType();

					if(strValue.trim().equalsIgnoreCase(EnumPresentationIntentType.FOR_PRESENTATION.getValue()) && !isPresent(0x0028, 0x1050) && !isPresent(0x0028, 0x3010))
						throw new ConditionFailedException("Condition Failed for Element 0028,3010");

					if(strValue.trim().equalsIgnoreCase(EnumPresentationIntentType.FOR_PRESENTATION.getValue()) && !isPresent(0x0028,0x3010) && !isPresent(0x0028,0x1050))
						throw new ConditionFailedException("Condition Failed for Element 0028,1050");
				}
				if(isPresent(0x0028,0x1050) && !isPresent(0x0028,0x1051))
					throw new ConditionFailedException("Condition Failed for Element 0028,1051");
			}
		}
		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 :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);
	}

	/**
	 * Retrieves the image Type.
	 * 
	 * @return - returns the Image Type
	 */
	public String[] getImageType()
	{
		Object objValue = getValue(0x0008,0x0008);
		if(objValue!=null)
			return (String[])objValue;
		return null;

	}

	/**
	 * 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.
	 * Enumerated Value of 1.
	 * 
	 * @param enumSamplesPerPixel the enum samples per pixel
	 */
	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 - 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 Specifies the intended interpretation of the pixel data.
	 * Enumerated Values:
	 * MONOCHROME1
	 * MONOCHROME2
	 * 
	 * @param enumPhotometricInterpretation the enum 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 - 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.
	 * Enumerated Values: 8, 16
	 * 
	 * @param enumBitsAllocated the enum 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 - 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.
	 * Enumerated Values: 6 to 16
	 * 
	 * @param enumBitsStored the enum 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 - 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 the enum 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 - 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;
	}

	/**
	 * Sets Data representation of the pixel samples. Each sample shall have the same pixel
	 * representation. Enumerated Values: 0000H = unsigned integer. 0001H = 2's complement
	 * 
	 * @param enumPixelRepresentation the enum pixel representation
	 */
	public void setPixelRepresentation(EnumPixelRepresentation enumPixelRepresentation)
	{
		/*Accept Data representation of 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, 0x0103, DicomConstants.DCM_DT_US, enumPixelRepresentation.getValue());
	}

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

	/**
	 * Sets relationship between the Pixel sample values and the X-Ray beam intensity.
	 * 
	 * @param enumPixelIntensityRelationship the enum pixel intensity relationship
	 */
	public void setPixelIntensityRelationship(EnumPixelIntensityRelationship enumPixelIntensityRelationship)
	{
		/*Accept Pixel Intensity Relationship 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, 0x1040, DicomConstants.DCM_DT_CS, enumPixelIntensityRelationship.getValue());
	}

	/**
	 * Retrieves relationship between the Pixel sample values and the X-Ray beam intensity.
	 * 
	 * @return - String value of Pixel Intensity Relationship
	 */
	public String getPixelIntensityRelationship()
	{
		Object objectValue = getValue(0x0028, 0x1040);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets the sign of the relationship between the Pixel sample values stored in Pixel Data
	 * (7FE0,0010) and the X-Ray beam intensity.
	 * Enumerated Values:
	 * 1 = Lower pixel values correspond to less X-Ray beam intensity,
	 * -1 = Higher pixel values correspond to less X-Ray beam intensity
	 * 
	 * @param enumPixelIntensityRelationshipSign the enum pixel intensity relationship sign
	 */
	public void setPixelIntensityRelationshipSign(EnumPixelIntensityRelationshipSign enumPixelIntensityRelationshipSign)
	{
		/*Accept Pixel Intensity Relationship Sign in short format of type SS.
		 * 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, 0x1041, DicomConstants.DCM_DT_SS, enumPixelIntensityRelationshipSign.getValue());
	}

	/**
	 * Retrieves  sign of the relationship between the Pixel sample values stored in Pixel Data
	 * (7FE0,0010) and the X-Ray beam intensity.
	 * 
	 * @return - String value of Pixel Intensity Relationship Sign
	 */
	public short getPixelIntensityRelationshipSign()
	{
		Object objectValue = getValue(0x0028, 0x1041);
		if(objectValue!=null)
			return Short.parseShort(objectValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}

	/**
	 * Sets the value b in the relationship between stored values (SV) in Pixel Data
	 * (7FE0,0010) and the output units specified in Rescale Type (0028,1054).
	 * Output units = m*SV + b.
	 * Enumerated Value: 0
	 * 
	 * @param enumRescaleIntercept the enum rescale intercept
	 */
	public void setRescaleIntercept(EnumRescaleIntercept enumRescaleIntercept)
	{
		/*Accept The value b in relationship between stored values (SV) and Hounsfield (HU) 
		 * 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, enumRescaleIntercept.getValue());
	}

	/**
	 * Retrieves Rescale Intercept.
	 * 
	 * @return - 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).
	 * Enumerated Value: 1
	 * 
	 * @param enumRescaleScope the enum rescale scope
	 */
	public void setRescaleScope(EnumRescaleScope enumRescaleScope)
	{
		/*Accept the equation specified in 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, 0x1053, DicomConstants.DCM_DT_DS, enumRescaleScope.getValue());
	}

	/**
	 * Retrieves m in the equation specified by Rescale Intercept (0028,1052).
	 * 
	 * @return the rescale scope
	 */
	public String getRescaleScope()
	{
		Object objectValue = getValue(0x0028, 0x1053);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets the value taht specifies the output units of Rescale Slope (0028,1053) and Rescale Intercept(0028,1052).
	 * Required if Rescale Intercept is present.
	 * Enumerated Value: US = Unspecified
	 * 
	 * @param enumRescaleType the enum rescale type
	 */
	public void setRescaleType(EnumRescaleType enumRescaleType)
	{
		/*Accept Rescale Type 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 Hash Map
		 */
		addDataElement(0x0028, 0x1054, DicomConstants.DCM_DT_LO, enumRescaleType.getValue());
	}

	/**
	 * Retrieves the output units of Rescale Slope (0028,1053) and Rescale Intercept(0028,1052).
	 * 
	 * @return - String value of Rescale Type
	 */
	public String getRescaleType()
	{
		Object objectValue = getValue(0x0028, 0x1054);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets a subset of a conceptual Presentation LUT.This Attribute defines an identity transformation or inverse
	 * identity transformation.
	 * Enumerated Values:
	 * IDENTITY - output is in P-Values - shall be
	 * used if Photometric Interpretation
	 * (0028,0004) is MONOCHROME2.
	 * INVERSE - output after inversion is in PValues
	 * - shall be used if Photometric
	 * Interpretation (0028,0004) is
	 * MONOCHROME1.
	 * 
	 * @param enumPresentationLUTShape the enum presentation lut shape
	 */
	public void setPresentationLUTShape(EnumPresentationLUTShape enumPresentationLUTShape)
	{
		/* Accept Presentation LUT 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 Hash Map
		 */
		addDataElement(0x2050,0x0020, DicomConstants.DCM_DT_CS, enumPresentationLUTShape.getValue());
	}

	/**
	 * Retrieves a subset of a conceptual Presentation LUT.
	 * 
	 * @return - String value of Presentation LUT Shape
	 */
	public String getPresentationLUTShape()
	{Object objectValue = getValue(0x2050,0x0020);
	if(objectValue!=null)
		return objectValue.toString();
	return null;
	}

	/**
	 * Sets a value that 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 the enum 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());
	}

	/**
	 * Retrieves the Lossy Image Compression.
	 * 
	 * @return - returns the Lossy Image Compression
	 */
	public String getLossyImageCompression()
	{
		Object objectValue = getValue(0x0028, 0x2110);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets the approximate lossy compression ratio(s) that have been applied to this image.
	 * 
	 * @param arrStrLossyImageCompressionRatio - String array of Lossy Image Compression Ratio
	 */
	public void setLossyImageCompressionRatio(String[] arrStrLossyImageCompressionRatio)
	{
		/*Accept the approximate lossy compression ratio(s) that have been applied to this image.
		 * 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, 0x2112, DicomConstants.DCM_DT_DS, arrStrLossyImageCompressionRatio);
	}

	/**
	 * Retrieves the Lossy Image Compression.
	 * 
	 * @return - returns the Lossy Image Compression
	 */
	public String[] getLossyImageCompressionRatio()
	{
		Object objValue = getValue(0x0028,0x2112);
		if(objValue!=null)
			return (String[])objValue;
		return null;

	}

	/**
	 * Sets a text description of how this image was derived.
	 * 
	 * @param strDerivationDescription - String value of Derivation Description
	 */
	public void setDerivationDescription(String strDerivationDescription)
	{
		/* Accept A text description of how this image was derived 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 Hash Map
		 */
		addDataElement(0x0008, 0x2111, DicomConstants.DCM_DT_ST, strDerivationDescription);
	}

	/**
	 * Retrieves a text description of how this image was derived.
	 * 
	 * @return - returns the Lossy Image Compression
	 */
	public String getDerivationDescription()
	{
		Object objectValue = getValue(0x0008, 0x2111);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets code representing the device-specific processing associated with the image (e.g.Organ Filtering code)
	 * 
	 * @param strAcquisitionDeviceProcessingCode - String value of Acquisition Device Processing Code
	 */
	public void setAcquisitionDeviceProcessingCode(String strAcquisitionDeviceProcessingCode)
	{
		/* Accept Acquisition Device Processing Code 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 Hash Map
		 */
		addDataElement(0x0018, 0x1401, DicomConstants.DCM_DT_LO, strAcquisitionDeviceProcessingCode);
	}

	/**
	 * Retrieves code representing the device-specific processing associated with the image.
	 * 
	 * @return - String value of Acquisition Device Processing Code
	 */
	public String getAcquisitionDeviceProcessingCode()
	{
		Object objectValue = getValue(0x0018, 0x1401);
		if(objectValue!=null)
			return objectValue.toString();
		return null;
	}

	/**
	 * Sets patient direction of the rows and columns of the image.
	 * 
	 * @param arrStrPatientOrientation - String array of Patient Orientation
	 */
	public void setPatientOrientation(String[] arrStrPatientOrientation)
	{
		/* Accept  Patient direction of the rows and columns of the image.
		 * 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(0x0020, 0x0020, DicomConstants.DCM_DT_CS, arrStrPatientOrientation);
	}

	/**
	 * Retrieves patient direction of the rows and columns of the image.
	 * 
	 * @return - String array of Patient Orientation
	 */
	public String[] getPatientOrientation()
	{
		Object objectValue = getValue(0x0020, 0x0020);
		if(objectValue!=null)
			return (String[])objectValue;
		return null;
	}

	/**
	 * Sets value that indicates whether a reference object (phantom) of known size is present in the
	 * image and was used for calibration. Enumerated Values: YES,NO.
	 * 
	 * @param enumCalibrationImage the enum calibration image
	 */
	public void setCalibrationImage(EnumCalibrationImage enumCalibrationImage)
	{
		/*Accept Calibration Image 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(0x0050,0x0004, DicomConstants.DCM_DT_CS, enumCalibrationImage.getValue());
	}

	/**
	 * Return value that indicates whether a reference object (phantom) of known size is present in the
	 * image and was used for calibration.
	 * 
	 * @return - String value of Calibration Image
	 */
	public String getCalibrationImage()
	{Object objectValue = getValue(0x0050,0x0004);
	if(objectValue!=null)
		return objectValue.toString();
	return null;
	}

	/**
	 * Sets value that indicates whether or not image contains sufficient burned in annotation to identify the
	 * patient and date the image was acquired.
	 * Enumerated Values:
	 * YES
	 * NO
	 * 
	 * @param enumBurnedInAnnotation the enum burned in annotation
	 */
	public void setBurnedInAnnotation(EnumBurnedInAnnotation enumBurnedInAnnotation)
	{
		/*Accept Indicates whether or not image contains 
		 * sufficient burned in annotation to identify the patient and date the image was acquired 
		 * 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, 0x0301, DicomConstants.DCM_DT_CS, enumBurnedInAnnotation.getValue());
	}

	/**
	 * Retrieves value that indicates whether or not image contains sufficient burned in annotation to identify the
	 * patient and date the image was acquired.
	 * 
	 * @return - String value of Burned In Annotation(Yes or No)
	 */
	public String getBurnedInAnnotation()
	{Object objectValue = getValue(0x0028,0x0301);
	if(objectValue!=null)
		return objectValue.toString();
	return null;
	}

	/**
	 * Returns a sequence of VOILUTs.
	 * 
	 * @return - instance of VOILUT Sequence
	 */
	public VOILUTSequence getVOILUTSequence()
	{
		VOILUTSequence objVOILUTSequence = (VOILUTSequence)getDicomValue(0x0028, 0x3010);
		if(objVOILUTSequence == 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();
			objVOILUTSequence = (VOILUTSequence)objDicomV3Factory.createSequence(0x0028, 0x3010, objITransferSyntax, objIDictionaryReader);

			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0028, 0x3010, DicomConstants.DCM_DT_SQ, objVOILUTSequence.getValue());
		}
		return objVOILUTSequence;
	}

	/**
	 * Sets Window Center for display.
	 * 
	 * @param arrStrWindowCenter - String value of  Window Center for display.
	 */	
	public void setWindowCenter(String[] arrStrWindowCenter)
	{
		/*Accept  Window Center for display in String Array format of type DS.
		 * 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 DataSet
		 */
		addDataElement(0x0028, 0x1050, DicomConstants.DCM_DT_DS, arrStrWindowCenter);
	}

	/**
	 * Retrieves Window Center for display.
	 * 
	 * @return - String array of Window Center
	 */
	public String[] getWindowCenter()
	{
		Object objectValue = getValue(0x0028, 0x1050);
		if(objectValue!=null)
			return (String[])objectValue;
		return null;
	}

	/**
	 * Sets Window Width for display.
	 * 
	 * @param arrStrWindowWidth - String value of Window Width for display.
	 */	
	public void setWindowWidth(String[] arrStrWindowWidth)
	{
		/*Accept  Window Width for display in String Array format of type DS.
		 * 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 DataSet
		 */
		addDataElement(0x0028, 0x1051, DicomConstants.DCM_DT_DS, arrStrWindowWidth);
	}

	/**
	 * Retrieves Window Width for display.
	 * 
	 * @return - String array of Window Width.
	 */
	public String[] getWindowWidth()
	{Object objectValue = getValue(0x0028,0x1051);
	if(objectValue!=null)
		return (String[])objectValue;
	return null;
	}

	/**
	 * Sets Free form explanation of the meaning of the Window Center and Width.
	 * Multiple values correspond to multiple Window Center and
	 * Width values.
	 * 
	 * @param arrStrWindowCenterWidthExplanation - String array of Window Center and Width.
	 */	
	public void setWindowCenterWidthExplanation(String[] arrStrWindowCenterWidthExplanation)
	{
		/* Accept Free form explanation of the meaning of the
		 * Window Center and Width. Multiple values correspond to multiple Window Center and 
		 * Width values. String Array format of type LO.
		 * 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 DataSet
		 */
		addDataElement(0x0028, 0x1055, DicomConstants.DCM_DT_LO, arrStrWindowCenterWidthExplanation);
	}

	/**
	 * Retrieves Free form explanation of the meaning of the Window Center and Width.
	 * 
	 * @return - String array of Window Center and Width Explanation
	 */
	public String[] getWindowCenterWidthExplanation()
	{Object objectValue = getValue(0x0028,0x1055);
	if(objectValue!=null)
		return (String[])objectValue;
	return null;
	}

	/* 
	 * This method is used by the Module Iterator to iterate through the DataSet and return only
	 * those elements that belong to the respective Module class whose getVectorOfKeys is called.
	 */
	/**
	 * This method returns the vector of keys representing the DataElements
	 * that belong to this module.
	 * 
	 * @return - returns the customized collection containing the dataelement
	 * tags that belong to this module
	 */
	public ISingleCollection<ITag> getVectorOfKeys()
	{
		return objSingleCollection;
	}
}
