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

import java.io.IOException;
import java.util.Locale;

import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataSet;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDicomStream;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDictionaryReader;
import cdac.medinfo.sdk.dcm30_04.commoninterface.ITransferSyntax;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.AcquisitionContextModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.CineModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.ClinicalTrialSeriesModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.ClinicalTrialStudyModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.ClinicalTrialSubjectModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.CommonInstanceReferenceModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.ContrastBolusModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.EnhancedContrastBolusModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.EnhancedGeneralEquipmentModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.FrameExtractionModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.FrameOfReferenceModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.GeneralImageModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.ICCProfileModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.ImageIOD;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.MultiFrameModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.OcularRegionImagedModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.OphthalmicPhotographicParametersModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.OphthalmicPhotographyAcquisitionParametersModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.OphthalmicPhotographyImageModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.OphthalmicPhotographySeriesModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.SOPCommonModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.SynchronizationModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.WideFieldOphthalmicPhotographyQualityRatingModule;
import cdac.medinfo.sdk.dcm30_04.dicommodel.modules.WideFieldOphthalmicPhotographyStereographicProjectionModule;
import cdac.medinfo.sdk.dcm30_04.enums.EnumModuleNames;
import cdac.medinfo.sdk.dcm30_04.enums.EnumSOPClassUIDs;

import cdac.medinfo.sdk.dcm30_04.exceptions.InvalidIODException;
import cdac.medinfo.sdk.dcm30_04.exceptions.InvalidModuleException;
import cdac.medinfo.sdk.dcm30_04.exceptions.ParseException;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConfig;
import cdac.medinfo.sdk.dcm30_04.utils.DicomLogger;
import cdac.medinfo.sdk.dcm30_04.utils.ResourceBundleWrapper;
/**
 * The Wide Field Ophthalmic Photography 3D Coordinates Image IOD specifies a multi-frame image acquired on a digital photographic DICOM modality.
 * @author saloni
 *
 */
public class WideFieldOphthalmicPhotography3DCoordinatesImageIOD extends ImageIOD{


	/**
	 * The Constant XAImageIOD.
	 */
	public static final String WIDE_FIELD_OPHTHALMIC_PHOTOGRAPHY_3D_COORDINATES_IMAGE_IOD = "Wide Field Ophthalmic Photography 3D Coordinates Image IOD";
	
	/**
	 * The obj clinical trial series module.
	 */
	ClinicalTrialSeriesModule objClinicalTrialSeriesModule = null;
	
	/**
	 * The obj clinical trial subject module.
	 */
	ClinicalTrialSubjectModule objClinicalTrialSubjectModule = null;

	
	/**
	 * Ophthalmic Photography Series
	 */
	OphthalmicPhotographySeriesModule objOphthalmicPhotographySeriesModule = null;
	
	/**
	 * Synchronization Module
	 */
	SynchronizationModule objSynchronizationModule = null;

	/**
	 * General Image Module
	 */
	GeneralImageModule objGeneralImageModule = null;
	
	/**
	 * Contrast Boluse Module
	 */
	EnhancedContrastBolusModule objEnhancedContrastBolusModule = null;
	
	/**
	 * Cine Module
	 */
	CineModule objCineModule = null;
	
	/**
	 * Multi Frame Module 
	 */
	MultiFrameModule objMultiFrameModule = null;
	
	/**
	 * Frame Pointer  
	 */
	FrameOfReferenceModule objFrameOfReferenceModule = null;
	
	/**
	 * Enhanced General Equipment
	 */
	EnhancedGeneralEquipmentModule objEnhancedGeneralEquipmentModule = null;
	
	/**
	 * Acquisition Context
	 */
	AcquisitionContextModule objAcquisitionContextModule = null;
	
	/**
	 *  Ophthalmic Photography Image
	 */
	OphthalmicPhotographyImageModule objOphthalmicPhotographyImageModule = null;
	
	/**
	 * Wide Field Ophthalmic PhotographyStereographic Projection
	 */
	WideFieldOphthalmicPhotographyStereographicProjectionModule objWideFieldOphthalmicPhotographyStereographicProjectionModule = null;
	
	/**
	 * Wide Field Ophthalmic Photography QualityRating
	 */
	WideFieldOphthalmicPhotographyQualityRatingModule objWideFieldOphthalmicPhotographyQualityRatingModule = null;
	
	/**
	 * Ocular Region Imaged
	 */
	OcularRegionImagedModule objOcularRegionImagedModule = null;
	
	/**
	 * Ophthalmic Photography Acquisition Parameters
	 */
	OphthalmicPhotographyAcquisitionParametersModule objOphthalmicPhotographyAcquisitionParametersModule = null;
	
	/**
	 * Ophthalmic Photographic Parameters
	 */
	OphthalmicPhotographicParametersModule objOphthalmicPhotographicParametersModule = null;
	
	/**
	 * ICC Profile
	 */
	ICCProfileModule objICCProfileModule = null;
	
	/**
	 * SOP Common Module
	 */
	SOPCommonModule objSOPCommonModule = null; 
	
	/**
	 * Common Instance Reference
	 */
	CommonInstanceReferenceModule objCommonInstanceReferenceModule = null;
	
	/**
	 * Frame Extraction Module
	 */
	FrameExtractionModule objFrameExtractionModule = null;
	
	
	/**
	 * Instantiates a new digital intra oral x ray image iod.
	 */
	public WideFieldOphthalmicPhotography3DCoordinatesImageIOD()
	{
		super();
	}

	/**
	 * This constructor initializes the TransferSyntax  in its superclass IOD.
	 * 
	 * @param objITransferSyntax_ - specifies the DICOM Standard defined TransfeSyntax.
	 */
	public WideFieldOphthalmicPhotography3DCoordinatesImageIOD(ITransferSyntax objITransferSyntax_)
	{
		super(objITransferSyntax_);
	}

	/**
	 * This constructor initializes the  DictionaryReader
	 * in its superclass IOD.
	 * 
	 * @param XAImageIOD - specifies the DICOM Dictionary reader to be used .
	 */
	public WideFieldOphthalmicPhotography3DCoordinatesImageIOD(IDictionaryReader objIDictionaryReader_)
	{
		super(objIDictionaryReader_);
	}

	/**
	 * This constructor accepts the DataSet from the user   in its superclass IOD.
	 * 
	 * @param objIDataSet_ - specifies the data set to be set in the IOD.
	 */
	public WideFieldOphthalmicPhotography3DCoordinatesImageIOD(IDataSet objIDataSet_)
	{
		super(objIDataSet_);
	}

	/**
	 * This constructor initializes the TransferSyntax and DictionaryReader in its super class IOD.
	 * 
	 * @param objITransferSyntax_ specifies the DICOM Standard defined TransfeSyntax.
	 * @param objIDictionaryReader_ specifies the DICOM Dictionary reader to be used .
	 */
	public WideFieldOphthalmicPhotography3DCoordinatesImageIOD(ITransferSyntax objITransferSyntax_,IDictionaryReader objIDictionaryReader_)
	{
		super(objITransferSyntax_,objIDictionaryReader_);
	}

	/**
	 * Creates XAImageIOD IOD from a DICOM file containing DigitalIntraOralXRay DICOM data.
	 * @param strFileName DICOM File with absolute path.
	 * @throws IOException Exception caused due to wrong I/O operations. 
	 * @throws ParseException signals if some parse exceptions are occurred.
	 * @throws InvalidIODException signals if some IOD exceptions are occurred.
	 */
	public WideFieldOphthalmicPhotography3DCoordinatesImageIOD(String strFileName)throws IOException,InvalidIODException
	{
		super(strFileName);
		try
		{
			if(objIDataSet != null)
			{
				String strSOPClassUID = objIDataSet.getSOPClassUID();
				if(strSOPClassUID != null)
				{
					if(!strSOPClassUID.equals(EnumSOPClassUIDs.WIDEFIELDOPHTHALMICPHOTOGRAPHY3DCOORDINATESIMAGEIOD.getValue()))
					{
						throw new InvalidIODException(ResourceBundleWrapper.getValue("exceptions", "InvalidIOD.FileNotMatched", new Locale(DicomConfig.createInstance().getLocale())) + WIDE_FIELD_OPHTHALMIC_PHOTOGRAPHY_3D_COORDINATES_IMAGE_IOD);
					}
				}
				strSOPClassUID = null;
			}
		}
		catch(InvalidIODException iie)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(iie.getMessage());
			}
			throw iie;
		}
	}
	
	/**
	 * Retrieves pre-initialized instance of Contrast Bolus Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return ContrastBolusModule - instance of {@link ContrastBolusModule}.
	 */
	public ClinicalTrialSeriesModule getClinicalTrialSeriesModule()
	{
		if(objClinicalTrialSeriesModule == null)
		{
			objClinicalTrialSeriesModule = new ClinicalTrialSeriesModule(objIDataSet);
			return objClinicalTrialSeriesModule;
		}
		return objClinicalTrialSeriesModule;
	}
	
	/**
	 * Retrieves pre-initialized instance of Clinical Trial Subject Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return ClinicalTrialSubjectModule - instance of {@link ClinicalTrialSubjectModule}.
	 */
	public ClinicalTrialSubjectModule getClinicalTrialSubjectModule()
	{
		if(objClinicalTrialSubjectModule == null)
		{
			objClinicalTrialSubjectModule = new ClinicalTrialSubjectModule(objIDataSet);
			return objClinicalTrialSubjectModule;
		}
		return objClinicalTrialSubjectModule;
	}
	
	/**
	 * Retrieves pre-initialized instance of Ophthalmic Photography Series Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return OphthalmicPhotographySeriesModule - instance of {@link OphthalmicPhotographySeriesModule}.
	 */
	public OphthalmicPhotographySeriesModule getOphthalmicPhotographySeriesModule()
	{
		if(objOphthalmicPhotographySeriesModule == null)
		{
			objOphthalmicPhotographySeriesModule = new OphthalmicPhotographySeriesModule(objIDataSet);
			return objOphthalmicPhotographySeriesModule;
		}
		return objOphthalmicPhotographySeriesModule;
	}
	
	
	
	/**
	 * Retrieves pre-initialized instance of Synchronization Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return SynchronizationModule - instance of {@link SynchronizationModule}.
	 */
	public SynchronizationModule getSynchronizationModule() 
	{
		if(objSynchronizationModule == null)
		{
			objSynchronizationModule = new SynchronizationModule(objIDataSet);
			return objSynchronizationModule;
		}
		return objSynchronizationModule;
	}
	
	/**
	 * Retrieves pre-initialized instance of General Image Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return GeneralImageModule - instance of {@link GeneralImageModule}.
	 */
	public GeneralImageModule getGeneralImageModule()
	{
		if(objGeneralImageModule == null)
		{
			objGeneralImageModule = new GeneralImageModule(objIDataSet);
			return objGeneralImageModule;
		}
		return objGeneralImageModule;
	}
	
	

	/**
	 * Retrieves pre-initialized instance of Contrast Bolus Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return ContrastBolusModule - instance of {@link ContrastBolusModule}.
	 */
	public EnhancedContrastBolusModule getEnhancedContrastBolusModule()
	{
		if(objEnhancedContrastBolusModule == null)
		{
			objEnhancedContrastBolusModule = new EnhancedContrastBolusModule(objIDataSet);
			return objEnhancedContrastBolusModule;
		}
		return objEnhancedContrastBolusModule;
	}

	/**
	 * Retrieves pre-initialized instance of Cine Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return CineModule - instance of {@link CineModule}.
	 */
	public CineModule getCineModule()
	{
		if(objCineModule == null)
		{
			objCineModule = new CineModule(objIDataSet);
			return objCineModule;
		}
		return objCineModule;
	}

	/**
	 * Retrieves pre-initialized instance of Multi Frame Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return CineModule - instance of {@link MultiFrameModule}.
	 */
	public MultiFrameModule getMultiFrameModule()
	{
		if(objMultiFrameModule == null)
		{
			objMultiFrameModule = new MultiFrameModule(objIDataSet);
			return objMultiFrameModule;
		}
		return objMultiFrameModule;
	} 
	
	
	/**
	 * Retrieves pre-initialized instance of Frame Of Reference Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return FrameOfReferenceModule - instance of {@link FrameOfReferenceModule}.
	 */
	public FrameOfReferenceModule getFrameOfReferenceModule() 
	{
		if(objFrameOfReferenceModule == null)
		{
			objFrameOfReferenceModule = new FrameOfReferenceModule(objIDataSet);
			return objFrameOfReferenceModule;
		}
		return objFrameOfReferenceModule;
	}
	
	/**
	 * Retrieves pre-initialized instance of SynchronizationModule. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return objSynchronizationModule - instance of {@link SynchronizationModule}.
	 */
	public EnhancedGeneralEquipmentModule getEnhancedGeneralEquipmentModule() 
	{
		if(objEnhancedGeneralEquipmentModule == null)
		{
			objEnhancedGeneralEquipmentModule = new EnhancedGeneralEquipmentModule(objIDataSet);
			return objEnhancedGeneralEquipmentModule;
		}
		return objEnhancedGeneralEquipmentModule;
	}
	
	/**
	 * Retrieves pre-initialized instance of Acquisition Context Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return AcquisitionContextModule - instance of {@link AcquisitionContextModule}.
	 */
	public AcquisitionContextModule getAcquisitionContextModule() 
	{
		if(objAcquisitionContextModule == null)
		{
			objAcquisitionContextModule = new AcquisitionContextModule(objIDataSet);
			return objAcquisitionContextModule;
		}
		return objAcquisitionContextModule;
	}

	/**
	 * Retrieves pre-initialized instance of Ophthalmic Photography Image Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return OphthalmicPhotographyImageModule - instance of {@link OphthalmicPhotographyImageModule}.
	 */
	public OphthalmicPhotographyImageModule getOphthalmicPhotographyImageModule()
	{
		if(objOphthalmicPhotographyImageModule == null)
		{
			objOphthalmicPhotographyImageModule = new OphthalmicPhotographyImageModule(objIDataSet);
			return objOphthalmicPhotographyImageModule;
		}
		return objOphthalmicPhotographyImageModule;
	}
	
	
	/**
	 * Retrieves pre-initialized instance of Wide Field Ophthalmic Photography Stereographic Projection Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return WideFieldOphthalmicPhotographyStereographicProjectionModule - instance of {@link WideFieldOphthalmicPhotographyStereographicProjectionModule}.
	 */
	public WideFieldOphthalmicPhotographyStereographicProjectionModule getWideFieldOphthalmicPhotographyStereographicProjectionModule()
	{
		if(objWideFieldOphthalmicPhotographyStereographicProjectionModule == null)
		{
			objWideFieldOphthalmicPhotographyStereographicProjectionModule = new WideFieldOphthalmicPhotographyStereographicProjectionModule(objIDataSet);
			return objWideFieldOphthalmicPhotographyStereographicProjectionModule;
		}
		return objWideFieldOphthalmicPhotographyStereographicProjectionModule;
	}
	
	/**
	 * Retrieves pre-initialized instance of Wide Field Ophthalmic Photography Stereographic Projection Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return WideFieldOphthalmicPhotographyStereographicProjectionModule - instance of {@link WideFieldOphthalmicPhotographyStereographicProjectionModule}.
	 */
	public WideFieldOphthalmicPhotographyQualityRatingModule getWideFieldOphthalmicPhotographyQualityRatingModule()
	{
		if(objWideFieldOphthalmicPhotographyQualityRatingModule == null)
		{
			objWideFieldOphthalmicPhotographyQualityRatingModule = new WideFieldOphthalmicPhotographyQualityRatingModule(objIDataSet);
			return objWideFieldOphthalmicPhotographyQualityRatingModule;
		}
		return objWideFieldOphthalmicPhotographyQualityRatingModule;
	}
	
	
	
	/**
	 * Retrieves pre-initialized instance of Ocular Region Imaged Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return OcularRegionImagedModule - instance of {@link OcularRegionImagedModule}.
	 */
	public OcularRegionImagedModule getOcularRegionImagedModule()
	{
		if(objOcularRegionImagedModule == null)
		{
			objOcularRegionImagedModule = new OcularRegionImagedModule(objIDataSet);
			return objOcularRegionImagedModule;
		}
		return objOcularRegionImagedModule;
	}
	
	/**
	 * Retrieves pre-initialized instance of Ophthalmic Photography Acquisition Parameters Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return OphthalmicPhotographyAcquisitionParametersModule - instance of {@link OphthalmicPhotographyAcquisitionParametersModule}.
	 */
	public OphthalmicPhotographyAcquisitionParametersModule getOphthalmicPhotographyAcquisitionParametersModule()
	{
		if(objOphthalmicPhotographyAcquisitionParametersModule == null)
		{
			objOphthalmicPhotographyAcquisitionParametersModule = new OphthalmicPhotographyAcquisitionParametersModule(objIDataSet);
			return objOphthalmicPhotographyAcquisitionParametersModule;
		}
		return objOphthalmicPhotographyAcquisitionParametersModule;
	}

	/**
	 * Retrieves pre-initialized instance of Ophthalmic Photographic Parameters Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return OphthalmicPhotographicParameters - instance of {@link OphthalmicPhotographicParameters}.
	 */
	public OphthalmicPhotographicParametersModule getOphthalmicPhotographicParametersModule()
	{
		if(objOphthalmicPhotographicParametersModule == null)
		{
			objOphthalmicPhotographicParametersModule = new OphthalmicPhotographicParametersModule(objIDataSet);
			return objOphthalmicPhotographicParametersModule;
		}
		return objOphthalmicPhotographicParametersModule;
	}

	/**
	 * Retrieves pre-initialized instance of ICCProfile Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return ICCProfileModule - instance of {@link ICCProfileModule}.
	 */
	public ICCProfileModule getICCProfileModule()
	{
		if(objICCProfileModule == null)
		{
			objICCProfileModule = new ICCProfileModule(objIDataSet);
			return objICCProfileModule;
		}
		return objICCProfileModule;
	}
	
	/**
	 * Retrieves pre-initialized instance of SOP Common Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return SOPCommonModule - instance of {@link SOPCommonModule}.
	 */
	public SOPCommonModule getSOPCommonModule()
	{
		if(objSOPCommonModule == null)
		{
			objSOPCommonModule = new SOPCommonModule(objIDataSet);
			return objSOPCommonModule;
		}
		return objSOPCommonModule;
	}
	/**
	 * Retrieves pre-initialized instance of Common Instance Reference Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return CommonInstanceReferenceModule - instance of {@link CommonInstanceReferenceModule}.
	 */
	public CommonInstanceReferenceModule getCommonInstanceReferenceModule()
	{
		if(objCommonInstanceReferenceModule == null)
		{
			objCommonInstanceReferenceModule = new CommonInstanceReferenceModule(objIDataSet);
			return objCommonInstanceReferenceModule;
		}
		return objCommonInstanceReferenceModule;
	}
	/**
	 * Retrieves pre-initialized instance of Frame Extraction Module. Creates a new instance
	 * if no pre-existing module instance is available.If previously created instance is
	 * present then returns the same module instance.
	 * 
	 * @return FrameExtractionModule - instance of {@link FrameExtractionModule}.
	 */
	public FrameExtractionModule getFrameExtractionModule()
	{
		if(objFrameExtractionModule == null)
		{
			objFrameExtractionModule = new FrameExtractionModule(objIDataSet);
			return objFrameExtractionModule;
		}
		return objFrameExtractionModule;
	}
	/**
	 * This method validates Digital XRay IOD according to the Module Table given in The DICOM Standard.
	 * The validate method fails if one of the mandatory modules are absent or any of the
	 * modules are invalid.The validate method also checks for conditional modules.
	 * 
	 * @return - function status indicating success or failure
	 * 
	 * @throws InvalidIODException - throws when the IOD is invalid
	 */
	public boolean validate() throws InvalidIODException
	{
		try{
			/*
			 * This condition calls ImageIOD class's validation which checks for common modules validation
			 */
			if(super.validate())	
				return false;

			getGeneralEquipmentModule().validateModule();
			getGeneralImageModule().validateModule();
			getOphthalmicPhotographySeriesModule().validateModule();
			getSOPCommonModule().validateModule();
			getFrameOfReferenceModule().validateModule();
			getSynchronizationModule().validateModule();
			getGeneralEquipmentModule().validateModule();
			getEnhancedGeneralEquipmentModule().validateModule();
			getMultiFrameModule().validateModule();
			getOphthalmicPhotographyImageModule().validateModule();
			getWideFieldOphthalmicPhotographyStereographicProjectionModule().validateModule();
			getOcularRegionImagedModule().validateModule();
			getOphthalmicPhotographyAcquisitionParametersModule().validateModule();
			getOphthalmicPhotographicParametersModule().validateModule();
			getSOPCommonModule().validateModule();
			/*
			 * This condition checks for Digital XRay IOD's User Optional modules validation
			 * For conditional modules, first the presence of the modules should be checked. Because
			 * absence of optional modules is not a problem whereas presence but invalid status of the
			 * optional module is a problem.
			 */
		
			if(isModulePresent(ClinicalTrialSubjectModule.objSingleCollection, objIDataSet))
				getClinicalTrialSubjectModule().validateModule();
			if(isModulePresent(ClinicalTrialStudyModule.objSingleCollection, objIDataSet))
				getClinicalTrialStudyModule().validateModule();
			if(isModulePresent(ClinicalTrialSeriesModule.objSingleCollection, objIDataSet))
				getClinicalTrialSeriesModule().validateModule();
			if(isModulePresent(AcquisitionContextModule.objSingleCollection, objIDataSet))
				getAcquisitionContextModule().validateModule();
			if(isModulePresent(CommonInstanceReferenceModule.objSingleCollection, objIDataSet))
				getCommonInstanceReferenceModule().validateModule();
			
		}catch(InvalidModuleException ime)
		{
			if(DicomConfig.createInstance().isLoggingOn())
				DicomLogger.getLogger().log(ime.getMessage());
			
				throw new InvalidIODException(WIDE_FIELD_OPHTHALMIC_PHOTOGRAPHY_3D_COORDINATES_IMAGE_IOD, ime);
		}
		return true;
	}


	/**
	 *  Dumps the Name of IOD,Module and corresponding Attributs of Module.
	 *  @param objIDicomStream - the Stream on which the Data is to be written.
	 *  @throws IOException - Exception is thrown indicating runtime failure of writing operation.
	 */
	public void dumpDICOMInfo(IDicomStream objIDicomStream) throws IOException
	{
		objIDicomStream.writeString(WIDE_FIELD_OPHTHALMIC_PHOTOGRAPHY_3D_COORDINATES_IMAGE_IOD + "\n");
		super.dumpDICOMInfo(objIDicomStream);

		objIDicomStream.writeString("\t" + getClinicalTrialSeriesModule().getClass().getSimpleName() + "\n");
		getClinicalTrialSeriesModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getClinicalTrialSubjectModule().getClass().getSimpleName() + "\n");
		getClinicalTrialSubjectModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getOphthalmicPhotographySeriesModule().getClass().getSimpleName() + "\n");
		getOphthalmicPhotographySeriesModule().dumpDICOMInfo(objIDicomStream);

		objIDicomStream.writeString("\t" + getSynchronizationModule().getClass().getSimpleName() + "\n");
		getSynchronizationModule().dumpDICOMInfo(objIDicomStream);
	
		objIDicomStream.writeString("\t" + getGeneralImageModule().getClass().getSimpleName() + "\n");
		getGeneralImageModule().dumpDICOMInfo(objIDicomStream);	

		objIDicomStream.writeString("\t" + getEnhancedContrastBolusModule().getClass().getSimpleName() + "\n");
		getEnhancedContrastBolusModule().dumpDICOMInfo(objIDicomStream);	
		
		objIDicomStream.writeString("\t" + getCineModule().getClass().getSimpleName() + "\n");
		getCineModule().dumpDICOMInfo(objIDicomStream);

		objIDicomStream.writeString("\t" + getMultiFrameModule().getClass().getSimpleName() + "\n");
		getMultiFrameModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getFrameOfReferenceModule().getClass().getSimpleName() + "\n");
		getFrameOfReferenceModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getEnhancedGeneralEquipmentModule().getClass().getSimpleName() + "\n");
		getEnhancedGeneralEquipmentModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getAcquisitionContextModule().getClass().getSimpleName() + "\n");
		getAcquisitionContextModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getOphthalmicPhotographyImageModule().getClass().getSimpleName() + "\n");
		getAcquisitionContextModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getWideFieldOphthalmicPhotographyStereographicProjectionModule().getClass().getSimpleName() + "\n");
		getWideFieldOphthalmicPhotographyStereographicProjectionModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getWideFieldOphthalmicPhotographyQualityRatingModule().getClass().getSimpleName() + "\n");
		getWideFieldOphthalmicPhotographyQualityRatingModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getOphthalmicPhotographicParametersModule().getClass().getSimpleName() + "\n");
		getOphthalmicPhotographicParametersModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getICCProfileModule().getClass().getSimpleName() + "\n");
		getICCProfileModule().dumpDICOMInfo(objIDicomStream);	
		
		objIDicomStream.writeString("\t" + getSOPCommonModule().getClass().getSimpleName() + "\n");
		getSOPCommonModule().dumpDICOMInfo(objIDicomStream);

		objIDicomStream.writeString("\t" + getCommonInstanceReferenceModule().getClass().getSimpleName() + "\n");
		getCommonInstanceReferenceModule().dumpDICOMInfo(objIDicomStream);
		
		objIDicomStream.writeString("\t" + getFrameExtractionModule().getClass().getSimpleName() + "\n");
		getFrameExtractionModule().dumpDICOMInfo(objIDicomStream);
	}

	/**
	 * Checks whether the Module is present in the IOD or not.
	 * @param strModuleName String value of module name 
	 * @return boolean - true if the module is present in the IOD, else false is returned.
	 */
	public boolean isModulePresent(String strModuleName)
	{
		if(!super.isModulePresent(strModuleName))
		{
			if(strModuleName == null || strModuleName.equals(""))
				return false;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.CLINICAL_TRIAL_SERIES_MODULE.getValue()) && isModulePresent(ClinicalTrialSeriesModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.CLINICAL_TRIAL_SUBJECT_MODULE.getValue()) && isModulePresent(ClinicalTrialSubjectModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.OPHTHALMIC_PHOTOGRAPHY_SERIES_MODULE.getValue()) && isModulePresent(OphthalmicPhotographySeriesModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.SYNCHRONIZATION_MODULE.getValue()) && isModulePresent(SynchronizationModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.GENERAL_IMAGE_MODULE.getValue()) && isModulePresent(GeneralImageModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.ENHANCED_CONTRAST_BOLUS_MODULE.getValue()) && isModulePresent(EnhancedContrastBolusModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.CINE_MODULE.getValue()) && isModulePresent(CineModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.MULTI_FRAME_MODULE.getValue()) && isModulePresent(MultiFrameModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.FRAME_OF_REFERENCE_MODULE.getValue()) && isModulePresent(FrameOfReferenceModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.ENHANCED_GENERAL_EQUIPMENT_MODULE.getValue()) && isModulePresent(EnhancedGeneralEquipmentModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.ACQUISITION_CONTEXT_MODULE.getValue()) && isModulePresent(AcquisitionContextModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.OPHTHALMIC_PHOTOGRAPHY_IMAGE_MODULE.getValue()) && isModulePresent(OphthalmicPhotographyImageModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.WIDE_FIELD_OPHTHALMIC_PHOTOGRAPHY_STEREOGRAPHIC_PROJECTION_MODULE.getValue()) && isModulePresent(WideFieldOphthalmicPhotographyStereographicProjectionModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.WIDE_FIELD_OPHTHALMIC_PHOTOGRAPHY_QUALITY_RATING_MODULE.getValue()) && isModulePresent(WideFieldOphthalmicPhotographyQualityRatingModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.WIDE_FIELD_OPHTHALMIC_PHOTOGRAPHY_QUALITY_RATING_MODULE.getValue()) && isModulePresent(WideFieldOphthalmicPhotographyQualityRatingModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.OCULAR_REGION_IMAGED_MODULE.getValue()) && isModulePresent(OcularRegionImagedModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.OPHTHALMIC_PHOTOGRAPHY_ACQUISITION_PARAMETERS_MODULE.getValue()) && isModulePresent(OphthalmicPhotographyAcquisitionParametersModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.OPHTHALMIC_PHOTOGRAPHIC_PARAMETERS_MODULE.getValue()) && isModulePresent(OphthalmicPhotographicParametersModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.ICC_PROFILE_MODULE.getValue()) && isModulePresent(ICCProfileModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.SOP_COMMON_MODULE.getValue()) && isModulePresent(SOPCommonModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.COMMON_INSTANCE_REFERENCE_MODULE.getValue()) && isModulePresent(CommonInstanceReferenceModule.objSingleCollection))
				return true;
			if(strModuleName.equalsIgnoreCase(EnumModuleNames.FRAME_EXTRACTION_MODULE.getValue()) && isModulePresent(FrameExtractionModule.objSingleCollection))
				return true;
			
			
			
			
			else
			{
				if(DicomConfig.createInstance().isLoggingOn())
				{
					DicomLogger objDicomLogger = DicomLogger.getLogger();
					objDicomLogger.log(this.getClass().getName() + " : " +ResourceBundleWrapper.getValue("status","ModuleNotPresent",new Locale(DicomConfig.createInstance().getLocale())) + strModuleName);
				}
				return false;
			}
		}
		return true;
	}

	

}
