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

import cdac.medinfo.sdk.dcm30_04.baselibs.ContentSequenceItem;
import cdac.medinfo.sdk.dcm30_04.srtree.SRTree;
import cdac.medinfo.sdk.dcm30_04.templates.cid.AcquisitionModality_CID29;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_AcquisitionModality;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ImageAcquisition;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_Unit;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_ImageAcquisition;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_Unit;
import cdac.medinfo.sdk.dcm30_04.templates.generaltemplates.Template;

/*
 * The Image Acquisition Template allows recording of the essential parameters of a digital image acquired
 * during the procedure.
 */
/**
 * This class represents ImageAcquisition - TID3101
 */
public class ImageAcquisition_TID3101 extends Template
{
	/**
	 * Object of AcquisitionModality_CID29
	 */
	private AcquisitionModality_CID29 objAcquisitionModality_CID29;

	/**
	 * Object of LogEntryQualifiers_TID3010
	 */
	private LogEntryQualifiers_TID3010 objLogEntryQualifiers_TID3010;

	/**
	 * Instantiates a new ImageAcquisition_TID3101 Template.
	 * @param objTree Object of SRTree.
	 */
	public ImageAcquisition_TID3101(SRTree objTree)
	{
		super(objTree);
	}

	/**
	 * Retrieves Log Entry Qualifiers
	 * @return objLogEntryQualifiers_TID3010 object of objLogEntryQualifiers_TID3010
	 */
	public LogEntryQualifiers_TID3010 getLogEntryQualifiers_TID3010()
	{
		if(objLogEntryQualifiers_TID3010 == null)
			objLogEntryQualifiers_TID3010 = new LogEntryQualifiers_TID3010(getSRTree());
		return this.objLogEntryQualifiers_TID3010;
	}

	/**
	 * Sets value for ImageAcquired
	 * @param arrPosition dentifier which shows the position of the node in the SR Tree.
	 *@param strRefSOPClassUIDForCORefMacro Reference SOP Class UID for Composite Object Reference Macro.
	 * @param strRefSOPInstanceUIDForCORefMacro Reference SOP Instance UID for Composite Object Reference Macro.
	 * @param arrStrReferencedFrameNumber String Array of Referenced Frame Number.
	 * @param strRefSOPClassUID Referenced SOP Class UID.
	 * @param strRefSOPInstanceUID Referenced SOP Instance UID.
	 */
	public void setImageAcquired(int[] arrPosition, String strRefSOPClassUIDForCORefMacro, String strRefSOPInstanceUIDForCORefMacro, String[] arrStrReferencedFrameNumber, String strRefSOPClassUID, String strRefSOPInstanceUID)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ImageAcquisition.IMAGE_ACQUIRED.getValue();
		String strCodeValue = EnumCV_ImageAcquisition.IMAGE_ACQUIRED_121138.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Creating a node of Value Type IMAGE and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createImageNode(arrPosition, strCodeMeaning, strCodeValue, strCSD, strRefSOPClassUIDForCORefMacro, strRefSOPInstanceUIDForCORefMacro, arrStrReferencedFrameNumber, strRefSOPClassUID, strRefSOPInstanceUID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Series Instance UID
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strSeriesInstanceUID String value for SeriesInstanceUID.
	 */
	public void setSeriesInstanceUID(int[] arrPosition, String strSeriesInstanceUID)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ImageAcquisition.SERIES_INSTANCE_UID.getValue();
		String strCodeValue = EnumCV_ImageAcquisition.SERIES_INSTANCE_UDI_112002.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Creating a node of Value Type UIDREF and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createUIDREFNode(arrPosition, strCodeMeaning, strCodeValue, strCSD, strSeriesInstanceUID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Acquisition Modality.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param enumAcquisitionModality value for AcquisitionModality
	 * @param strCodingSchemeVersionForCode CodingSchemeVersion 
	 */
	public void setAcquisitionModality(int[] arrPosition, EnumCM_AcquisitionModality enumAcquisitionModality,String strCodingSchemeVersionForCode)
	{
		if(objAcquisitionModality_CID29 == null)
			this.objAcquisitionModality_CID29 = new AcquisitionModality_CID29();
		/**
		 * Sets the value for OrganizationalRoles which follows the template CID7452
		 */
		this.objAcquisitionModality_CID29.setAcquisitionModality(enumAcquisitionModality);

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCM = objAcquisitionModality_CID29.getCodeMeaning();
		String strCV = objAcquisitionModality_CID29.getCodeValue();
		String strCSD1 = objAcquisitionModality_CID29.getCodingSchemeDesignator();

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ImageAcquisition.MODALITY.getValue();
		String strCodeValue = EnumCV_ImageAcquisition.MODALITY_121139.getValue();
		String strCSD2 = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Creating a node of Value Type CODE and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createCodeNode(arrPosition, strCodeMeaning,strCodeValue , strCSD2, strCV, strCSD1, strCodingSchemeVersionForCode, strCM);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Number of Frames.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param arrNumericValue String array for Numeric Value.
	 */
	public void setNumberOfFrames(int[] arrPosition,String[] arrNumericValue)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ImageAcquisition.NUMBER_OF_FRAMES.getValue();
		String strCodeValue = EnumCV_ImageAcquisition.NUMBER_OF_FRAMES_121140.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		ContentSequenceItem objContentSequenceItem = getSRTree().createNumNode(arrPosition,strCodeMeaning,strCodeValue,strCSD,arrNumericValue,"","","","","","","","");
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Image Type
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param strImageType String value for Image Type.
	 */
	public void setImageType(int[] arrPosition, String strImageType)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ImageAcquisition.IMAGE_TYPE.getValue();
		String strCodeValue = EnumCV_ImageAcquisition.IMAGE_TYPE_121141.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Creating a node of Value Type TEXT and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createTextNode(arrPosition, strCodeMeaning, strCodeValue, strCSD, strImageType);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for PositionerPrimaryAngle.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param arrNumericValue String array for Numeric Value.
	 */
	public void setPositionerPrimaryAngle(int[] arrPosition,String[] arrNumericValue)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator For Unit for No of Fetus.
		 */
		String strCMForUnit = EnumCM_Unit.DEGREE.getValue();
		String strCVForUnit = EnumCV_Unit.DEGREE.getValue();
		String strCSDForUnit = EnumCodingSchemeDesignator.UCUM.getValue();

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ImageAcquisition.POSITIONARY_PRIMARY_ANGLE.getValue();
		String strCodeValue = EnumCV_ImageAcquisition.POSITIONARY_PRIMARY_ANGLE_112011.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		ContentSequenceItem objContentSequenceItem = getSRTree().createNumNode(arrPosition,strCodeMeaning,strCodeValue,strCSD,arrNumericValue,strCVForUnit,strCSDForUnit,"",strCMForUnit,"","","","");
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for PositionerSecondaryAngle.
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param arrNumericValue String array for Numeric Value.
	 */
	public void setPositionerSecondaryAngle(int[] arrPosition,String[] arrNumericValue)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator For Unit for No of Fetus.
		 */
		String strCMForUnit = EnumCM_Unit.DEGREE.getValue();
		String strCVForUnit = EnumCV_Unit.DEGREE.getValue();
		String strCSDForUnit = EnumCodingSchemeDesignator.UCUM.getValue();

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_ImageAcquisition.POSITIONARY_SECONDARY_ANGLE.getValue();
		String strCodeValue = EnumCV_ImageAcquisition.POSITIONARY_SECONDARY_ANGLE_112012.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		ContentSequenceItem objContentSequenceItem = getSRTree().createNumNode(arrPosition,strCodeMeaning,strCodeValue,strCSD,arrNumericValue,strCVForUnit,strCSDForUnit,"",strCMForUnit,"","","","");
		getSRTree().addChild(objContentSequenceItem);
	}

}
