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

import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataElement;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDictionaryReader;
import cdac.medinfo.sdk.dcm30_04.commoninterface.ITransferSyntax;
import cdac.medinfo.sdk.dcm30_04.enums.EnumImageBoxLargeScrollType;
import cdac.medinfo.sdk.dcm30_04.enums.EnumImageBoxLayoutType;
import cdac.medinfo.sdk.dcm30_04.enums.EnumImageBoxScrollDirection;
import cdac.medinfo.sdk.dcm30_04.enums.EnumImageBoxSmallScrollType;
import cdac.medinfo.sdk.dcm30_04.exceptions.ConditionFailedException;
import cdac.medinfo.sdk.dcm30_04.exceptions.InvalidItemException;
import cdac.medinfo.sdk.dcm30_04.exceptions.MandatoryMissingException;
import cdac.medinfo.sdk.dcm30_04.exceptions.ValidationException;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConfig;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConstants;
import cdac.medinfo.sdk.dcm30_04.utils.DicomLogger;
/**
* This item class contains the methods to set, get and validate the attribute present in Image Boxes Sequence .
 */


public class ImageBoxesSequenceItem extends Item
{
	

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * This constructor creates the item and internal code sequence macro with default TransferSyntax 
	 */
	ImageBoxesSequenceItem()
	{
		super();
	}


	/**
	 * This constructor creates the item and internal code sequence macro with specified TransferSyntax 
	 * and default DictionaryReader
	 * @param objITransferSyntax specifies the DICOM Standard defined TransfeSyntax
	 */
	ImageBoxesSequenceItem(ITransferSyntax objITransferSyntax)
	{
		super(objITransferSyntax);
	}

	/**
	 * This constructor creates Image Boxes Sequence with specified TransferSyntax and
	 * specified DictionaryReader
	 * @param objTransferSyntax specifies the DICOM Standard defined TransfeSyntax
	 * @param objDictionaryReader specifies the DICOM Dictionary reader to be used 
	 */
	ImageBoxesSequenceItem(ITransferSyntax objTransferSyntax, IDictionaryReader objDictionaryReader)
	{
		super(objTransferSyntax,objDictionaryReader);
	}

	/**
	 * Validates all the attributes in FillStyleSequenceItem that are present in the DataSet
	 * @return boolean - Success -true, Failure - false
	 * @throws InvalidItemException throws InvalidItemException If Conditional element fails.
	 */
	public boolean validateForModule()  throws InvalidItemException
	{
		try
		{
			/*if(contains(0x0070,0x0257) && getDataForTag(0x0070, 0x0257).getValue().equals(EnumFillMode.STIPPELED))
				if(!contains(0x0070,0x0256))
					throw new ConditionFailedException("0x0070,0x0256") ;*/
			if(!contains(0x0072,0x0302))
				throw new MandatoryMissingException("0072,0302") ;
			if(!contains(0x0072,0x0108))
				throw new MandatoryMissingException("0072,0108") ;
			if(!contains(0x0072,0x0304))
				throw new MandatoryMissingException("0072,0304") ;
			if(contains(0x0072,0x0306) && (!getDataForTag(0x0072, 0x0304).getValue().equals(EnumImageBoxLayoutType.TILED)))
					throw new ConditionFailedException("0x0072,0x0306") ;
			if(contains(0x0072,0x0308) && (!getDataForTag(0x0072, 0x0304).getValue().equals(EnumImageBoxLayoutType.TILED)))
				throw new ConditionFailedException("0x0072,0x0308") ;
			if(contains(0x0072,0x0310) && ((Integer.valueOf((String)getDataForTag(0x0072,0x0306).getValue()) < 1)) || 
					((Integer.valueOf((String)getDataForTag(0x0072,0x0308).getValue()) < 1)))
				throw new ConditionFailedException("0x0072,0x0310") ;
			if(contains(0x0072,0x0312) && ((Integer.valueOf((String)getDataForTag(0x0072,0x0306).getValue()) < 1)) || 
					((Integer.valueOf((String)getDataForTag(0x0072,0x0308).getValue()) < 1)))
				throw new ConditionFailedException("0x0072,0x0312") ;
			if(contains(0x0072,0x0314)&& (!contains(0x0072,0x0312)))
					throw new ConditionFailedException("0x0072,0x0314") ;
			if(contains(0x0072,0x0316) && (!getDataForTag(0x0072, 0x0304).getValue().equals(EnumImageBoxLayoutType.TILED)) &&
				((Integer.valueOf((String)getDataForTag(0x0072,0x0306).getValue()) < 1)) || ((Integer.valueOf((String)getDataForTag(0x0072,0x0308).getValue()) < 1)))
				throw new ConditionFailedException("0x0072,0x0316") ;
			if(contains(0x0072,0x0318) && (!contains(0x0072,0x0316)))
				throw new ConditionFailedException("0072,0318") ;
			if(contains(0x0018,0x1244) && (!getDataForTag(0x0072, 0x0304).getValue().equals(EnumImageBoxLayoutType.CINE)))
				throw new ConditionFailedException("0x0018,0x1244") ;
			if(contains(0x0008,0x2144) && (!getDataForTag(0x0072, 0x0304).getValue().equals(EnumImageBoxLayoutType.CINE)) && contains(0x0072,0x0330))
				throw new ConditionFailedException("0x0018,0x1244") ;
			if(contains(0x0072,0x0330) && (!getDataForTag(0x0072, 0x0304).getValue().equals(EnumImageBoxLayoutType.CINE)) && contains(0x0008,0x2144))
				throw new ConditionFailedException("0x0072,0x0330") ;
			
		}
		catch( MandatoryMissingException ce)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(ce.getMessage());
			}
			throw new InvalidItemException(this.getClass().getSimpleName(),ce); 
		}
		catch(ConditionFailedException ce)
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger.getLogger().log(ce.getMessage());
			}
			throw new ValidationException(this.getClass().getSimpleName(),ce); 
		}
		return true;
	}
	
	public void setImageBoxNumber(short[] arrImageBoxNumber)
	{
		/*Accept the Referenced Frame Numbers in Array of short format of type US.
		 * A monotonically increasing integer that identifies the order of image boxes for scrolling, 
		 * Starting from 1, incrementing by 1, unique within a Display Set Sequence Item.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x0072, 0x0302, arrImageBoxNumber,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0302,DicomConstants.DCM_DT_US, arrImageBoxNumber);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves order of image boxes for scrolling.
	 * @return short Array - frames in a Multi-frame SOP Instance.
	 */
	public short[] getImageBoxNumber()
	{
		Object objValue = getValue(0x0072, 0x0302);
		if(objValue != null)
			return (short[])objValue;
		return null;
	}

	/**
	 * Sets the Minimal value of Chemical Shift Frequency in ppm.
	 * @param dblChemicalShiftsMinimumIntegrationLimitOnppm Double value of coordinates
	 */
	public void setDisplayEnvironmentSpatialPosition(double dblDisplayEnvironmentSpatialPosition)
	{
		/* Accept the Display Environment Spatial Position in double format of type FD.
		 * Four unitless floating point values indicating the rectangular coordinateposition of the image box within the overall bounding box 
		 * that encompasses all the display space (across all screens).
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0072,0x0108, dblDisplayEnvironmentSpatialPosition,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0072,0x0108,DicomConstants.DCM_DT_FD, dblDisplayEnvironmentSpatialPosition);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves the Minimal value of Display Environment Spatial Position.
	 * @return double - double value of DisplayEnvironmentSpatialPosition
	 */
	public double getDisplayEnvironmentSpatialPosition()
	{
		Object objValue = getValue(0x0072,0x0108);
		if(objValue != null)
			return Double.parseDouble(objValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}
	
	/**
	 * Sets the Image Box Layout Type Defined Type of layout of the image box
	 * @param strImageBoxLayoutType Specifies type of the value encoded in this Item
	 */
	public void setImageBoxLayoutType(EnumImageBoxLayoutType enumImageBoxLayoutType)
	{
		/* Accept the Value Type in Enum format of type TILED,STACK,CINE,PROCESSED,SINGLE.
		 * All types except for TILED are single rectangles containing a single frame of image pixel data. 
		 * The types are primarily distinguished by their interaction technique.
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0072, 0x0304, enumImageBoxLayoutType,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0304,DicomConstants.DCM_DT_CS, enumImageBoxLayoutType);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves type of the value encoded in this Item
	 * @return String - Type of the value encoded in this Item
	 */
	public String getImageBoxLayoutType()
	{
		Object objValue = getValue(0x0072, 0x0304);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets the Image Box Tile Horizontal Dimension
	 * @param arrImageBoxTileHorizontalDimension which is Positive integer defining the horizontal Image Box tile dimension
	 */
	public void setImageBoxTileHorizontalDimension(short[] arrImageBoxTileHorizontalDimension)
	{
		/* Accept the Image Box TileHorizontal Dimension in Array of short format of type US.
		 * integer defining the horizontal Image Box tile dimension; the number of columns.
	     * Required if the value of Image Box Layout Type (0072,0304) is TILED.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x0072, 0x0306, arrImageBoxTileHorizontalDimension,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0306,DicomConstants.DCM_DT_US, arrImageBoxTileHorizontalDimension);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Image Box Tile Horizontal Dimension in a Multi-frame SOP Instance.
	 * @return short Array - Image Box Tile Horizontal Dimension in a Multi-frame SOP Instance.
	 */
	public short[] getImageBoxTileHorizontalDimension()
	{
		Object objValue = getValue(0x0072, 0x0306);
		if(objValue != null)
			return (short[])objValue;
		return null;
	}

	/**
	 * Sets the Image Box Tile Horizontal Dimension
	 * @param arrImageBoxTileHorizontalDimension which is Positive integer defining the horizontal Image Box tile dimension
	 */
	public void setImageBoxTileVerticalDimension(short[] arrImageBoxTileVerticalDimension)
	{
		/* Accept the Image Box TileHorizontal Dimension in Array of short format of type US.
		 * Positive integer defining the vertical Image Box tile dimension
	     * Required if the value of Image Box Layout Type (0072,0304) is TILED.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x0072, 0x0308, arrImageBoxTileVerticalDimension,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0308,DicomConstants.DCM_DT_US, arrImageBoxTileVerticalDimension);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Image Box Tile Horizontal Dimension in a Multi-frame SOP Instance.
	 * @return short Array - Image Box Tile Horizontal Dimension in a Multi-frame SOP Instance.
	 */
	public short[] getImageBoxTileVerticalDimension()
	{
		Object objValue = getValue(0x0072, 0x0308);
		if(objValue != null)
			return (short[])objValue;
		return null;
	}

	/**
	 * Sets the Value Type Defined in EnumImageBoxScrollDirection 
	 * as VERTICAL - scroll images by row,
	 * HORIZONTAL - scroll images by column
	 * @param enumImageBoxScrollDirection Specifies type of the value encoded in this Item
	 */
	public void setImageBoxScrollDirection(EnumImageBoxScrollDirection enumImageBoxScrollDirection)
	{
		/* Accept the Value Type in Enum format of type CS.
		 * Required if the value of Image Box Layout Type (0072,0304) is TILED,
		 * and the value of Image Box Tile Horizontal Dimension (0072,0306) or 
		 * Image Box Tile Vertical Dimension (0072,0308) is greater than 1.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0072, 0x0310, enumImageBoxScrollDirection,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0310,DicomConstants.DCM_DT_CS, enumImageBoxScrollDirection);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves type of the value encoded in this Item
	 * @return String - Type of the value encoded in this Item
	 */
	public String getImageBoxScrollDirection()
	{
		Object objValue = getValue(0x0072, 0x0310);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets the Value Type Defined in EnumImageBoxSmallScrollType 
	 * PAGE - In a TILED image box, replace all image slots with the next N x M images in the set,
	 * ROW_COLUMN - In a TILED image box, move each row or column of images to the next row or column, depending on Image Box Scroll Direction
	 * IMAGE - In a TILED image box, move each image to the next slot, either horizontally or vertically, depending on Image Box ScrollDirection (0072,0310).
	 * @param enumImageBoxSmallScrollType Specifies type of the value encoded in this Item
	 */
	public void setImageBoxSmallScrollType(EnumImageBoxSmallScrollType enumImageBoxSmallScrollType)
	{
		/* Accept the Value Type in Enum format of type CS.
		 * Required if the value of Image Box Layout Type (0072,0304) is TILED, and
		 * the value of Image Box Tile Horizontal Dimension (0072,0306) or 
		 * Image Box TileVertical Dimension (0072,0308) is greater than 1.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0072, 0x0312, enumImageBoxSmallScrollType,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0312,DicomConstants.DCM_DT_CS, enumImageBoxSmallScrollType);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves type of the value encoded in this Item
	 * @return String - Type of the value encoded in this Item
	 */
	public String getImageBoxSmallScrollType()
	{
		Object objValue = getValue(0x0072, 0x0312);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets the Image Box Small Scroll Amount
	 * @param arrImageBoxTileHorizontalDimension which is Positive integer defining the horizontal Image Box tile dimension
	 */
	public void setImageBoxSmallScrollAmount(short[] arrImageBoxSmallScrollAmount)
	{
		/* Accept the Referenced Frame Numbers in Array of short format of type US.
		 * Defines the positive integer number of pages, rows, columns, 
		 * or images per small increment scroll
		 * The value applies to both forward and backward scrolling.
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x0072, 0x0314, arrImageBoxSmallScrollAmount,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0314,DicomConstants.DCM_DT_US, arrImageBoxSmallScrollAmount);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves one or more frames in a Multi-frame SOP Instance.
	 * @return short Array - frames in a Multi-frame SOP Instance.
	 */
	public short[] getImageBoxSmallScrollAmount()
	{
		Object objValue = getValue(0x0072, 0x0314);
		if(objValue != null)
			return (short[])objValue;
		return null;
	}

	/**
	 * Sets the Value Type Defined in EnumImageBoxLargeScrollType 
	 * PAGE - In a TILED image box, replace all image slots with the next N x M images in the set,
	 * ROW_COLUMN - In a TILED image box, move each row or column of images to the next row or column, depending on Image Box Scroll Direction
	 * IMAGE - In a TILED image box, move each image to the next slot, either horizontally or vertically, depending on Image Box ScrollDirection (0072,0310).
	 * @param enumImageBoxSmallScrollType Specifies type of the value encoded in this Item
	 */
	public void setImageBoxLargeScrollType(EnumImageBoxLargeScrollType enumImageBoxLargeScrollType)
	{
		/* Accept the Value Type in Enum format of type CS.
		 * Required if the value of Image Box Layout Type (0072,0304) is TILED, and
		 * the value of Image Box Tile Horizontal Dimension (0072,0306) or 
		 * Image Box TileVertical Dimension (0072,0308) is greater than 1.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0072, 0x0316, enumImageBoxLargeScrollType,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0316,DicomConstants.DCM_DT_CS, enumImageBoxLargeScrollType);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves type of the value encoded in this Item
	 * @return String - Type of the value encoded in this Item
	 */
	public String getImageBoxLargeScrollType()
	{
		Object objValue = getValue(0x0072, 0x0316);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * Sets the Value Type Defined in Image Box Large Scroll Amount 
	 * Defines the positive integer number of pages, rows, columns, or images per large increment scroll, 
	 * It is based on the values of Image Box Large Scroll Type(0072,0316) and Image Box Scroll Direction (0072,0310).
	 * @param arrImageBoxLargeScrollAmount Specifies type of the value encoded in this Item
	 */
	public void setImageBoxLargeScrollAmount(short[] arrImageBoxLargeScrollAmount)
	{
		/* Accept the Image Box Large Scroll Amount in Array of short format of type US.
		 * The value applies toboth forward and backward scrolling.
		 * Required if Image Box Large Scroll Type (0072,0316) is present with a value.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x0072, 0x0318, arrImageBoxLargeScrollAmount,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0318,DicomConstants.DCM_DT_US, arrImageBoxLargeScrollAmount);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Image Box Large Scroll Amount.
	 * @return short Array - frames in SOP Instance.
	 */
	public short[] getImageBoxLargeScrollAmount()
	{
		Object objValue = getValue(0x0072, 0x0318);
		if(objValue != null)
			return (short[])objValue;
		return null;
	}

	/**
	 * Sets the Value Type Defined in Image Box Overlap Priority
	 * If this Image Box overlaps in spatial position with others, 
	 * this attribute indicates the layer of this Image Box in relation to the others.
	 * @param arrImageBoxOverlapPriority Specifies type of the value encoded in this Item
	 */
	public void setImageBoxOverlapPriority(short[] arrImageBoxOverlapPriority)
	{
		/* Accept the Image Box Overlap Priority short format of type US.
		 * If this Image Box overlaps in spatial position with others, 
		 * this attribute indicates the layer of this Image Box in relation to the others.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x0072, 0x0320, arrImageBoxOverlapPriority,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0320,DicomConstants.DCM_DT_US, arrImageBoxOverlapPriority);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Image Box Overlap Priority.
	 * @return short Array - frames in SOP Instance.
	 */
	public short[] getImageBoxOverlapPriority()
	{
		Object objValue = getValue(0x0072, 0x0320);
		if(objValue != null)
			return (short[])objValue;
		return null;
	}
	
	/**
	 * Sets the Value Type Defined in Preferred Play back Sequencing
	 * Describes the preferred play back sequencing for the Image Box. 
	 * Overrides any,any Preferred Play back Sequencing (0018,1244) value in the image objects being displayed.
	 * @param arrPreferredPlaybackSequencing Specifies type of the value encoded in this Item
	 */
	public void setPreferredPlaybackSequencing(short shPreferredPlaybackSequencing)
	{
		/* Accept the array Preferred Play back Sequencing short format of type US.
		 * It is preferred play back sequencing for the Preferred Play back Sequencing
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x0018, 0x1244,shPreferredPlaybackSequencing,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0018, 0x1244,DicomConstants.DCM_DT_US, shPreferredPlaybackSequencing);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Preferred Play back Sequencing.
	 * @return short Array - frames in SOP Instance.
	 */
	public short getPreferredPlaybackSequencing()
	{
		Object objValue = getValue(0x0018, 0x1244);
		if(objValue != null)
			return Short.parseShort(objValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}

	
	
	
	
	
	
	
	
	
	/**
	 * Sets Recommended Display Frame Rate. 
	 * Recommended rate at which the frames of a multi-frame image shall bedisplayed, in frames/second.
	 * @param strReferencedReferenceImageNumber String value of Referenced Reference Image Number.
	 */
	public void setRecommendedDisplayFrameRate (String strRecommendedDisplayFrameRate )
	{
		/* Accept the Referenced Reference Image Number  in String format of type IS.
		 * Shall have a value greater than zero. Overridesany Recommended Display Frame Rate (0008,2144) value in the image objectsbeing displayed.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0008,0x2144, strRecommendedDisplayFrameRate ,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0008,0x2144,DicomConstants.DCM_DT_IS, strRecommendedDisplayFrameRate );

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves Recommended Display Frame Rate.
	 * Overrides any Recommended Display Frame Rate (0008,2144) value in the image objects being displayed.
	 * @return String - value of Referenced Reference Image Number.
	 */
	public String getRecommendedDisplayFrameRate()
	{
		Object objValue = getValue(0x0008,0x2144);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets the Cine Relative to Real Time.
	 * @param dblCineRelativetoRealTime Double value of coordinates
	 */
	public void setCineRelativetoRealTime(double dblCineRelativetoRealTime)
	{
		/* Accept the Chemical Shifts Minimum Integration Limit in ppm in double format of type FD.
		 * A positive unit less floating point numeric factor equal to play back rate divided by acquisition rate.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0072, 0x0330, dblCineRelativetoRealTime,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0072, 0x0330,DicomConstants.DCM_DT_FD, dblCineRelativetoRealTime);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves the Minimal value of Chemical Shift Frequency in ppm.
	 * @return double - double value of ChemicalShiftsMinimumIntegrationLimitOnppm
	 */
	public double getCineRelativetoRealTime()
	{
		Object objValue = getValue(0x0072, 0x0330);
		if(objValue != null)
			return Double.parseDouble(objValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}
}
