/*******************************************************************************
 *  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.AcquisitionDeviceTypeCodeSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.CodeSequenceMacroDependentItem;
import cdac.medinfo.sdk.dcm30_04.baselibs.DicomV3Factory;
import cdac.medinfo.sdk.dcm30_04.baselibs.SourceImageSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.Tag;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataSet;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IItem;
import cdac.medinfo.sdk.dcm30_04.commoninterface.ITag;
import cdac.medinfo.sdk.dcm30_04.enums.EnumBurnedInAnnotation;
import cdac.medinfo.sdk.dcm30_04.enums.EnumCalibrationImage;
import cdac.medinfo.sdk.dcm30_04.enums.EnumImageType;
import cdac.medinfo.sdk.dcm30_04.enums.EnumLossyImageCompression;
import cdac.medinfo.sdk.dcm30_04.enums.EnumPhotometricInterpretation;
import cdac.medinfo.sdk.dcm30_04.enums.EnumPixelRepresentation;
import cdac.medinfo.sdk.dcm30_04.enums.EnumPlanarConfiguration;
import cdac.medinfo.sdk.dcm30_04.enums.EnumPresentationLUTShape;
import cdac.medinfo.sdk.dcm30_04.enums.EnumRecognizableVisualFeatures;
import cdac.medinfo.sdk.dcm30_04.enums.EnumSamplesPerPixel;
import cdac.medinfo.sdk.dcm30_04.enums.EnumSamplesPerPixelUsed;

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

// TODO: Auto-generated Javadoc
/**
 \* This module specifies the Attributes that describe an Ophthalmic Photography Image
 * produced by Ophthalmic Photography equipment (OP) imaging Modalities.
 */
public class OphthalmicPhotographyImageModule extends Module   
{


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


	/**
	 * Instantiates a new ophthalmic photography image module.
	 * 
	 * @param objIDataSet the obj i data set
	 */
	public OphthalmicPhotographyImageModule(IDataSet objIDataSet)
	{
		super(objIDataSet);
	}

	static
	{
		objSingleCollection = new SingleCollection<ITag>();
		objSingleCollection.add(new Tag(0x0008,0x0008));
		objSingleCollection.add(new Tag(0x0008,0x0023));
		objSingleCollection.add(new Tag(0x0008,0x0033));
		objSingleCollection.add(new Tag(0x0008,0x002A));
		objSingleCollection.add(new Tag(0x0008,0x2112));
		objSingleCollection.add(new Tag(0x0020,0x0013));
		objSingleCollection.add(new Tag(0x0028,0x0002));
		objSingleCollection.add(new Tag(0x0028,0x0003));
		objSingleCollection.add(new Tag(0x0028,0x0004));
		objSingleCollection.add(new Tag(0x0028,0x0103));
		objSingleCollection.add(new Tag(0x0028,0x0006));
		objSingleCollection.add(new Tag(0x0028,0x0030));
		objSingleCollection.add(new Tag(0x0028,0x0301));
		objSingleCollection.add(new Tag(0x0028,0x2110));
		objSingleCollection.add(new Tag(0x0028,0x2112));
		objSingleCollection.add(new Tag(0x0028,0x2114));
		objSingleCollection.add(new Tag(0x0050,0x0004));
		objSingleCollection.add(new Tag(0x2050,0x0020));
		objSingleCollection.add(new Tag(0x0028,0x0302));
	}

	/**
	 * Sets Image identification characteristics.
	 * 
	 * @param arrstrImageType the arrstr image type
	 */	
	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;
	}

	/**
	 * The method is used to set A number that identifies this image.
	 * The function accepts a String Value and creates the
	 * DE based on the transfer syntax and populates the DE with right values.
	 * This De is then added to the Module HashMap
	 * 
	 * @param strInstanceNumber - String value of Instance Number
	 */
	public void setInstanceNumber(String strInstanceNumber)
	{
		/* Accept Instance Numberin 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
		 */
		addDataElement(0x0020, 0x0013, DicomConstants.DCM_DT_IS, strInstanceNumber);
	}

	/**
	 * Retrieves the Instance number.
	 * 
	 * @return String - the instance number
	 */
	public String getInstanceNumber()
	{
		Object objValue = getValue(0x0020,0x0013);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * Method is used to set Number of samples (planes) in this image
	 * The function accepts a String Value and creates the
	 * DE based on the transfer syntax and populates the DE with right values.
	 * This De is then added to the Module HashMap
	 * 
	 * @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());
	}


	/**
	 * Return the short value of the attribute Samples Per Pixel.
	 * 
	 * @return short - returns the Samples per pixel
	 */
	public short getSamplesPerPixel()
	{
		Object objValue = getValue(0x0028,0x0002);
		if(objValue != null)
			return Short.parseShort(objValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}

	/**
	 * Method is used to The number of samples (planes) containing information.
	 * The function accepts a String Value and creates the
	 * DE based on the transfer syntax and populates the DE with right values.
	 * This De is then added to the Module HashMap
	 * 
	 * @param enumSamplesPerPixelUsed the enum samples per pixel used
	 */
	public void setSamplesPerPixelUsed(EnumSamplesPerPixelUsed enumSamplesPerPixelUsed)
	{
		/*Accept Number of set Samples Per Pixel Used 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 Hash Map
		 */
		addDataElement(0x0028, 0x0003, DicomConstants.DCM_DT_US, enumSamplesPerPixelUsed.getValue());
	}


	/**
	 * Return the number of samples (planes) containing information.
	 * 
	 * @return short - number of samples (planes) containing information
	 */
	public short getSamplesPerPixelUsed()
	{
		Object objValue = getValue(0x0028,0x0003);
		if(objValue != null)
			return Short.parseShort(objValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}

	/**
	 * Sets Specifies the intended interpretation of the pixel data.
	 * 
	 * @param enumPhotometricInterpretation - Enum value 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 objValue = getValue(0x0028,0x0004);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * 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 short - returns the pixel representation
	 */
	public short getPixelRepresentation()
	{
		Object objValue = getValue(0x0028,0x0103);
		if(objValue != null)
			return Short.parseShort(objValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}

	/**
	 * Indicates whether the pixel data are sent color-by-plane or color-by-pixel.
	 * 
	 * @param enumPlanarConfiguration the enum planar configuration
	 */
	public void setPlanarConfiguration(EnumPlanarConfiguration enumPlanarConfiguration)
	{
		/*Accept Planar Configuration 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, 0x0006, DicomConstants.DCM_DT_US, enumPlanarConfiguration.getValue());
	}

	/**
	 * Retrieves the planar configuration.
	 * 
	 * @return short - returns the planar configuration
	 */
	public short getPlanarConfiguration()
	{
		Object objValue = getValue(0x0028,0x0006);
		if(objValue != null)
			return Short.parseShort(objValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}

	/**
	 * Sets physical distance in the patient between the center of each pixel, specified by a
	 * numeric pair - adjacent row spacing (delimiter) adjacent column spacing in mm.
	 * 
	 * @param arrStrPixelSpacing : String array of Pixel Spacing.
	 */	
	public void setPixelSpacing(String[] arrStrPixelSpacing)
	{
		/*Accept the direction cosines of the first row and the first column with respect
		 *to the patient 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 Hash Map
		 */
		addDataElement(0x0028, 0x0030, DicomConstants.DCM_DT_DS, arrStrPixelSpacing);
	}

	/**
	 * Retrieves physical distance in the patient between the center of each pixel.
	 * 
	 * @return String[] - String array of Pixel Spacing.
	 */
	public String[] getPixelSpacing()
	{
		Object objValue = getValue(0x0028,0x0030);
		if(objValue != null)
			return (String[])objValue;
		return null;
	}

	/**
	 * Sets the time the document content creation started.
	 * 
	 * @param strContentTime String value of time
	 */
	public void setContentTime(String strContentTime)
	{
		/*Accept The Time at which image pixel data creation 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, 0x0033, DicomConstants.DCM_DT_TM, strContentTime);
	}

	/**
	 * Retrieves the time the document content creation started.
	 * 
	 * @return String - String value of a time
	 */
	public String getContentTime()
	{
		Object objValue = getValue(0x0008,0x0033);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * Sets the date the document content creation started.
	 * 
	 * @param strContentDate String value of date
	 */
	public void setContentDate(String strContentDate)
	{
		/*Accept The date on image pixel data creation 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,0x0023, DicomConstants.DCM_DT_DA, strContentDate);
	}

	/**
	 * Retrieves the date the document content creation started.
	 * 
	 * @return String - String value of a date
	 */
	public String getContentDate()
	{
		Object objValue = getValue(0x0008,0x0023);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * The method is used to set The Date and Time the acquisition of data that resulted in this image started
	 * The function accepts a String Value and creates the
	 * DE based on the transfer syntax and populates the DE with right values.
	 * This De is then added to the Module HashMap
	 * 
	 * @param strAcquisitionDatetime - String value of Acquisition Date and Time
	 */
	public void setAcquisitionDatetime(String strAcquisitionDatetime)
	{
		/*Accept The Date and 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, 0x002A, DicomConstants.DCM_DT_DT, strAcquisitionDatetime);
	}

	/**
	 * Retrieves the Date and Time of Acquisition.
	 * 
	 * @return String - returns the Date and Time of Acquisition
	 */
	public String getAcquisitionDatetime()
	{
		Object objValue = getValue(0x0008, 0x002A);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * This method Returns provides the pre-initialized object of Source Image Sequence
	 * return - object of Source Image Sequence. If the module contans 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 SourceImageSequence - the source image sequence
	 */
	public SourceImageSequence getSourceImageSequence()
	{
		SourceImageSequence objSourceImageSequence = (SourceImageSequence)getDicomValue(0x0008, 0x2112);
		if(objSourceImageSequence == 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();
			objSourceImageSequence = (SourceImageSequence)objDicomV3Factory.createSequence(0x0008, 0x2112, objITransferSyntax, objIDictionaryReader);
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0008, 0x2112, DicomConstants.DCM_DT_SQ, objSourceImageSequence.getValue());
		}
		return objSourceImageSequence;
	}

	/**
	 * 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 objValue = getValue(0x0028, 0x2110);
		if(objValue != null)
			return objValue.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 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, 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;
	}


	/**
	 * The method is used to set lossy compression method(s) that have been applied to this image.
	 * The function accepts a String Value and creates the
	 * DE based on the transfer syntax and populates the DE with right values.
	 * This De is then added to the Module HashMap
	 * 
	 * @param arrStrLossyImageCompressionMethod - Lossy Image Compression Method
	 */
	public void setLossyImageCompressionMethod(String[] arrStrLossyImageCompressionMethod)
	{
		/*Accept lossy compression method(s) that have been applied to this 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(0x0028, 0x2114, DicomConstants.DCM_DT_CS, arrStrLossyImageCompressionMethod);
	}

	/**
	 * Retrieves the Lossy Image Compression Method.
	 * 
	 * @return String[] - the Lossy Image Compression Method
	 */
	public String[] getLossyImageCompressionMethod()
	{
		Object objValue = getValue(0x0028, 0x2114);
		if(objValue != null)
			return (String[])objValue;
		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 identity transformation for the Presentation LUT 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
		 * Enumerated Values are:
			IDENTITY - output is in P-Values - shall
			be used if Photometric Interpretation
			(0028,0004) is MONOCHROME2 or any
			color photometric interpretation.
			INVERSE - output after inversion is in PValues
			- shall be used if Photometric
			Interpretation (0028,0004) is
			MONOCHROME1.
		 */
		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 objValue = getValue(0x2050,0x0020);
		if(objValue != null)
			return objValue.toString();
		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 objValue = getValue(0x0050,0x0004);
		if(objValue != null)
			return objValue.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 objValue = getValue(0x0028,0x0301);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets Recognizable Visual Features.
	 * Indicates whether or not the image contains sufficiently recognizable visual features 
	 * to allow the image or a reconstruction from a set of images to identify the patient.
	 * Enumerated Values:
	 * 1) YES 
	 * 2) NO
	 * 
	 * @param enumRecognizableVisualFeatures the enum Recognizable Visual Features
	 */
	public void setRecognizableVisualFeatures(EnumRecognizableVisualFeatures  enumRecognizableVisualFeatures)
	{
		/* Accept Recognizable Visual Features 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
		 */
		addDataElement(0x0028, 0x0302, DicomConstants.DCM_DT_CS, enumRecognizableVisualFeatures.getValue());
	}

	/**
	 * Retrieves Recognizable Visual Features.
	 * 
	 * @return String - String value of Recognizable Visual Features.
	 */ 
	public String getRecognizableVisualFeatures()
	{
		Object objValue = getValue(0x0028,0x0302);
		if(objValue != null)
			return objValue.toString();
		return null;
	}


	/* (non-Javadoc)
	 * @see cdac.medinfo.sdk.dcm30_04.dicommodel.modules.Module#validateModule()
	 */
	@Override
	public  boolean validateModule() throws InvalidModuleException
	{

		try
		{			/*
		 * Validation Rules for Mandatory Elements
		 */
			if(!isPresent(0x0008,0x0008))
				throw new MandatoryMissingException("0008,0008");
			if(!isPresent(0x0020,0x0013))
				throw new MandatoryMissingException("0020,0013");
			if(!isPresent(0x0028,0x0002))
				throw new MandatoryMissingException("0028,0002");
			if(!isPresent(0x0028,0x0004))
				throw new MandatoryMissingException("0028,0004");
			if(!isPresent(0x0028,0x0103))
				throw new MandatoryMissingException("0028,0103");
			if(!isPresent(0x0008,0x0033))
				throw new MandatoryMissingException("0008,0033");
			if(!isPresent(0x0008,0x0023))
				throw new MandatoryMissingException("0008,0023");
			if(!isPresent(0x0028,0x2110))
				throw new MandatoryMissingException("0028,2110");
			if(!isPresent(0x0028,0x0301))
				throw new MandatoryMissingException("0028,0301");

			//0028,0003 -> Required if different from Samples per Pixel (0028,0002).
			if(isPresent(0x0028, 0x0003) && EnumSamplesPerPixelUsed.TWO.getValue() != getSamplesPerPixelUsed())
				throw new ConditionFailedException("0028,0003 Required and value should be 2 i.e. different from Samples per Pixel (0028,0002).");

			int iNumberOfSamples = getSamplesPerPixel();
			if(iNumberOfSamples > 1 && (!isPresent(0x0028,0x0006)))
				throw new ConditionFailedException("0028,0006 required if value of conditional Element 0028,0006 is greater than 1");

			//0028,0030 ->Required when Acquisition Device Type Code Sequence (0022,0015) contains an item with the value (SRT, R-1021A,"Fundus Camera")
			OphthalmicPhotographicParametersModule objOphthalmicPhotographicParametersModule = new OphthalmicPhotographicParametersModule(objIDataSet);
			AcquisitionDeviceTypeCodeSequence objAcquisitionDeviceTypeCodeSequence = objOphthalmicPhotographicParametersModule.getAcquisitionDeviceTypeCodeSequence();
			ICollectionIterator<IItem>	acquisitionDeviceTypeCodeSequenceiterator = null;
			if(objAcquisitionDeviceTypeCodeSequence != null)
				acquisitionDeviceTypeCodeSequenceiterator =	objAcquisitionDeviceTypeCodeSequence.iterator();
			CodeSequenceMacroDependentItem objCodeSequenceMacroDependentItem = null;
			while(acquisitionDeviceTypeCodeSequenceiterator.hasNext())
				objCodeSequenceMacroDependentItem = (CodeSequenceMacroDependentItem)acquisitionDeviceTypeCodeSequenceiterator.next();

			String strCodeValue = objCodeSequenceMacroDependentItem.getCodeSequenceMacro().getCodeValue();
			String strCodingSchemeDesignator = objCodeSequenceMacroDependentItem.getCodeSequenceMacro().getCodeSchemeDesignator();
			String strCodeMeaning = objCodeSequenceMacroDependentItem.getCodeSequenceMacro().getCodeMeaning();
			if( !isPresent(0x0028, 0x0030) && (strCodeValue.equals("SRT")) && (strCodingSchemeDesignator.equals("R-1021A")) && (strCodeMeaning.equals("Fundus Camera")))
				throw new ConditionFailedException("0028,0030 ->Required when Acquisition Device Type Code Sequence (0022,0015) contains an item with the value (SRT, R-1021A,\"Fundus Camera\"");

			String [] arrStrImageType = getImageType();
			String strOriginal = EnumImageType.Value1.ORIGINAL.getValue();
			String strDerived = EnumImageType.Value1.DERIVED.getValue();
			if(strOriginal.equals(arrStrImageType[0]) && !isPresent(0x0008,0x002A))
				throw new ConditionFailedException("0008,002A Required if Image Type (0008,0008) Value 1 is " + strOriginal);

			if(strDerived.equals(arrStrImageType[0]) && !isPresent(0x0008,0x2112))
				throw new ConditionFailedException("0008,2112 Required if Image Type (0008,0008) Value 1 is " + strDerived);
			if(isPresent(0x0008,0x2112))
				getSourceImageSequence().validateForModule();

			short shLossyCompression = Short.parseShort(EnumLossyImageCompression.LOSSY_COMPRESSED.getValue());
			if((1 == shLossyCompression) && !isPresent(0x0028,0x2112))
				throw new ConditionFailedException("0028,2112 Required if (0028,2110) has a value of 01");

			if((1 == shLossyCompression) && !isPresent(0x0028,0x2114))
				throw new ConditionFailedException("0028,2114 Required if (0028,2110) has a value of 01");

			String strMonochrome2 = EnumPhotometricInterpretation.MONOCHROME2.getValue();
			if(strMonochrome2.equals(getPhotometricInterpretation()) && !isPresent(0x2050,0x0020))
				throw new ConditionFailedException("2050,0020 Required if (0028,0004) is " + strMonochrome2);
		}
		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;
	}

	/**
	 * 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;
	}
}
