function dict = dicm_dict(vendor, flds)
% Return dicom dictionary for specified vendor.
%
% dict = DICM_DICT(vendor, dicmFields);
%
% The vendor is used to assign those vendor-specific private tags for SIEMENS,
% GE and Philips. Other vendors can be added easily into the file.
%
% If only partial dictionary is needed, the struct fields can be used as
% the 2nd input.
%
% See also DICM_HDR, DICM2NII, DICM_IMG

% History (yymmdd):
% 130823 Write it for dicm2nii.m (xiangrui.li@gmail.com)
% 131105 Make DTI parameter names more consistent across vendors.
% 141021 Store requested fields, so set dict when switching vendors.
% 141024 Use LocationsInAcquisition as nSL for all vendors.
% 141030 Make ScanningSequence & SequenceVariant consistent for vendors.
% 150114 Add two more CSA header duplicate tags, and more command tags.
% 160411 dict contains group and element.
% 171211 Add Siemens grp 0021 and more.
% 180514 Guess more Siemens grp 0021 tags, correct BandwidthPerPixelPhaseEncode.
% 180914 Add vendor UIH.

if nargin<1, vendor = 'SIEMENS'; end
dict.vendor = vendor;
% Shortened items common across vendors from Matlab dicom-dict.txt
%    group element vr  name
C = {
    '0002' '0001' 'OB' 'FileMetaInformationVersion'
    '0002' '0002' 'UI' 'MediaStorageSOPClassUID'
    '0002' '0003' 'UI' 'MediaStorageSOPInstanceUID'
    '0002' '0010' 'UI' 'TransferSyntaxUID'
    '0002' '0012' 'UI' 'ImplementationClassUID'
    '0002' '0013' 'SH' 'ImplementationVersionName'
    '0002' '0016' 'AE' 'SourceApplicationEntityTitle'
    '0002' '0100' 'UI' 'PrivateInformationCreatorUID'
    '0008' '0005' 'CS' 'SpecificCharacterSet'
    '0008' '0008' 'CS' 'ImageType'
    '0008' '0012' 'DA' 'InstanceCreationDate'
    '0008' '0013' 'TM' 'InstanceCreationTime'
    '0008' '0014' 'UI' 'InstanceCreatorUID'
    '0008' '0016' 'UI' 'SOPClassUID'
    '0008' '0018' 'UI' 'SOPInstanceUID'
    '0008' '0020' 'DA' 'StudyDate'
    '0008' '0021' 'DA' 'SeriesDate'
    '0008' '0022' 'DA' 'AcquisitionDate'
    '0008' '0023' 'DA' 'ContentDate'
    '0008' '002A' 'DT' 'AcquisitionDateTime'
    '0008' '0030' 'TM' 'StudyTime'
    '0008' '0031' 'TM' 'SeriesTime'
    '0008' '0032' 'TM' 'AcquisitionTime'
    '0008' '0033' 'TM' 'ContentTime'
    '0008' '0050' 'SH' 'AccessionNumber'
    '0008' '0060' 'CS' 'Modality'
    '0008' '0064' 'CS' 'ConversionType'
    '0008' '0070' 'LO' 'Manufacturer'
    '0008' '0080' 'LO' 'InstitutionName'
    '0008' '0081' 'ST' 'InstitutionAddress'
    '0008' '0090' 'PN' 'ReferringPhysicianName'
    '0008' '0100' 'SH' 'CodeValue'
    '0008' '0102' 'SH' 'CodingSchemeDesignator'
    '0008' '0104' 'LO' 'CodeMeaning'
    '0008' '010B' 'CS' 'ContextGroupExtensionFlag'
    '0008' '0201' 'SH' 'TimezoneOffsetFromUTC'
    '0008' '1010' 'SH' 'StationName'
    '0008' '1030' 'LO' 'StudyDescription'
    '0008' '1032' 'SQ' 'ProcedureCodeSequence'
    '0008' '103E' 'LO' 'SeriesDescription'
    '0008' '1040' 'LO' 'InstitutionalDepartmentName'
    '0008' '1048' 'PN' 'PhysicianOfRecord'
    '0008' '1050' 'PN' 'PerformingPhysicianName'
    '0008' '1060' 'PN' 'PhysicianReadingStudy'
    '0008' '1070' 'PN' 'OperatorName'
    '0008' '1080' 'LO' 'AdmittingDiagnosesDescription'
    '0008' '1090' 'LO' 'ManufacturerModelName'
    '0008' '1110' 'SQ' 'ReferencedStudySequence'
    '0008' '1111' 'SQ' 'ReferencedPerformedProcedureStepSequence'
    '0008' '1115' 'SQ' 'ReferencedSeriesSequence'
    '0008' '1120' 'SQ' 'ReferencedPatientSequence'
    '0008' '1140' 'SQ' 'ReferencedImageSequence'
    '0008' '1150' 'UI' 'ReferencedSOPClassUID'
    '0008' '1155' 'UI' 'ReferencedSOPInstanceUID'
    '0008' '1160' 'IS' 'ReferencedFrameNumber'
    '0008' '1199' 'SQ' 'ReferencedSOPSequence'
    '0008' '1250' 'SQ' 'RelatedSeriesSequence'
    '0008' '2111' 'ST' 'DerivationDescription'
    '0008' '2112' 'SQ' 'SourceImageSequence'
    '0008' '2218' 'SQ' 'AnatomicRegionSequence'
    '0008' '9007' 'CS' 'FrameType'
    '0008' '9092' 'SQ' 'ReferencedImageEvidenceSequence'
    '0008' '9121' 'SQ' 'ReferencedRawDataSequence'
    '0008' '9123' 'UI' 'CreatorVersionUID'
    '0008' '9154' 'SQ' 'SourceImageEvidenceSequence'
    '0008' '9205' 'CS' 'PixelPresentation'
    '0008' '9206' 'CS' 'VolumetricProperties'
    '0008' '9207' 'CS' 'VolumeBasedCalculationTechnique'
    '0008' '9208' 'CS' 'ComplexImageComponent'
    '0008' '9209' 'CS' 'AcquisitionContrast'
    '0010' '0010' 'PN' 'PatientName'
    '0010' '0020' 'LO' 'PatientID'
    '0010' '0021' 'LO' 'IssuerOfPatientID'
    '0010' '0030' 'DA' 'PatientBirthDate'
    '0010' '0040' 'CS' 'PatientSex'
	'0010' '0050' 'SQ' 'PatientInsurancePlanCodeSequence'
    '0010' '1000' 'LO' 'OtherPatientID'
    '0010' '1010' 'AS' 'PatientAge'
    '0010' '1020' 'DS' 'PatientSize'
    '0010' '1030' 'DS' 'PatientWeight'
	'0010' '1040' 'LO' 'PatientAddress'
    '0010' '1080' 'LO' 'MilitaryRank'
    '0010' '2110' 'LO' 'ContrastAllergies'
    '0010' '21B0' 'LT' 'AdditionalPatientHistory'
    '0010' '21C0' 'US' 'PregnancyStatus'
	'0010' '2201' 'LO' 'PatientSpeciesDescription'
	'0010' '2210' 'CS' 'AnatomicalOrientationType'
    '0010' '2299' 'LO' 'ResponsibleOrganization'
    '0010' '4000' 'LT' 'PatientComments'
    '0012' '0062' 'CS' 'PatientIdentityRemoved'
    '0012' '0063' 'LO' 'DeidentificationMethod'
	'0012' '0064' 'SQ' 'DeidentificationMethodCodeSequence'
    '0018' '0015' 'CS' 'BodyPartExamined'
    '0018' '0020' 'CS' 'ScanningSequence'
    '0018' '0021' 'CS' 'SequenceVariant'
    '0018' '0022' 'CS' 'ScanOptions'
    '0018' '0023' 'CS' 'MRAcquisitionType'
    '0018' '0024' 'SH' 'SequenceName'
    '0018' '0025' 'CS' 'AngioFlag'
    '0018' '0050' 'DS' 'SliceThickness'
    '0018' '0060' 'DS' 'KVP'
    '0018' '0080' 'DS' 'RepetitionTime'
    '0018' '0081' 'DS' 'EchoTime'
    '0018' '0082' 'DS' 'InversionTime'
    '0018' '0083' 'DS' 'NumberOfAverages'
    '0018' '0084' 'DS' 'ImagingFrequency'
    '0018' '0085' 'SH' 'ImagedNucleus'
    '0018' '0086' 'IS' 'EchoNumber'
    '0018' '0087' 'DS' 'MagneticFieldStrength'
    '0018' '0088' 'DS' 'SpacingBetweenSlices'
    '0018' '0089' 'IS' 'NumberOfPhaseEncodingSteps'
    '0018' '0090' 'DS' 'DataCollectionDiameter'
    '0018' '0091' 'IS' 'EchoTrainLength'
    '0018' '0093' 'DS' 'PercentSampling'
    '0018' '0094' 'DS' 'PercentPhaseFieldOfView'
    '0018' '0095' 'DS' 'PixelBandwidth'
    '0018' '1000' 'LO' 'DeviceSerialNumber'
    '0018' '1012' 'DA' 'DateOfSecondaryCapture'
    '0018' '1014' 'TM' 'TimeOfSecondaryCapture'
    '0018' '1020' 'LO' 'SoftwareVersion'
    '0018' '1030' 'LO' 'ProtocolName'
    '0018' '1050' 'DS' 'SpatialResolution'
    '0018' '1060' 'DS' 'TriggerTime'
    '0018' '1063' 'DS' 'FrameTime'
    '0018' '1088' 'IS' 'HeartRate'
    '0018' '1090' 'IS' 'CardiacNumberOfImages'
    '0018' '1094' 'IS' 'TriggerWindow'
    '0018' '1100' 'DS' 'ReconstructionDiameter'
    '0018' '1110' 'DS' 'DistanceSourceToDetector'
    '0018' '1111' 'DS' 'DistanceSourceToPatient'
    '0018' '1120' 'DS' 'GantryDetectorTilt'
    '0018' '1130' 'DS' 'TableHeight'
    '0018' '1140' 'CS' 'RotationDirection'
    '0018' '1147' 'CS' 'FieldOfViewShape'
    '0018' '1149' 'IS' 'FieldOfViewDimensions'
    '0018' '1150' 'IS' 'ExposureTime'
    '0018' '1151' 'IS' 'XrayTubeCurrent'
    '0018' '1152' 'IS' 'Exposure'
    '0018' '1160' 'SH' 'FilterType'
    '0018' '1170' 'IS' 'GeneratorPower'
    '0018' '1181' 'CS' 'CollimatorType'
    '0018' '1190' 'DS' 'FocalSpot'
    '0018' '1210' 'SH' 'ConvolutionKernel'
    '0018' '1200' 'DA' 'DateOfLastCalibration'
    '0018' '1201' 'TM' 'TimeOfLastCalibration'
    '0018' '1242' 'IS' 'ActualFrameDuration'
    '0018' '1250' 'SH' 'ReceiveCoilName'
    '0018' '1251' 'SH' 'TransmitCoilName'
    '0018' '1310' 'US' 'AcquisitionMatrix'
    '0018' '1312' 'CS' 'InPlanePhaseEncodingDirection'
    '0018' '1314' 'DS' 'FlipAngle'
    '0018' '1315' 'CS' 'VariableFlipAngleFlag'
    '0018' '1316' 'DS' 'SAR'
    '0018' '1318' 'DS' 'dBdt'
    '0018' '1081' 'IS' 'LowRRValue'
    '0018' '1082' 'IS' 'HighRRValue'
    '0018' '1083' 'IS' 'IntervalsAcquired'
    '0018' '1084' 'IS' 'IntervalsRejected'
    '0018' '2003' 'DS' 'FramePrimaryAngleVector'
    '0018' '2004' 'DS' 'FrameSecondaryAngleVector'
    '0018' '2005' 'DS' 'SliceLocationVector'
    '0018' '5100' 'CS' 'PatientPosition'
    '0018' '9004' 'CS' 'ContentQualification'
    '0018' '9005' 'SH' 'PulseSequenceName'
    '0018' '9006' 'SQ' 'MRImagingModifierSequence'
    '0018' '9008' 'CS' 'EchoPulseSequence'
    '0018' '9009' 'CS' 'InversionRecovery'
    '0018' '9010' 'CS' 'FlowCompensation'
    '0018' '9011' 'CS' 'MultipleSpinEcho'
    '0018' '9012' 'CS' 'MultiplanarExcitation'
    '0018' '9014' 'CS' 'PhaseContrast'
    '0018' '9015' 'CS' 'TimeOfFlightContrast'
    '0018' '9016' 'CS' 'Spoiling'
    '0018' '9017' 'CS' 'SteadyStatePulseSequence'
    '0018' '9018' 'CS' 'EchoPlanarPulseSequence'
    '0018' '9019' 'FD' 'TagAngleFirstAxis'
    '0018' '9020' 'CS' 'MagnetizationTransfer'
    '0018' '9021' 'CS' 'T2Preparation'
    '0018' '9022' 'CS' 'BloodSignalNulling'
    '0018' '9024' 'CS' 'SaturationRecovery'
    '0018' '9025' 'CS' 'SpectrallySelectedSuppression'
    '0018' '9026' 'CS' 'SpectrallySelectedExcitation'
    '0018' '9027' 'CS' 'SpatialPresaturation'
    '0018' '9028' 'CS' 'Tagging'
    '0018' '9029' 'CS' 'OversamplingPhase'
    '0018' '9030' 'FD' 'TagSpacingFirstDimension'
    '0018' '9032' 'CS' 'GeometryOfKSpaceTraversal'
    '0018' '9033' 'CS' 'SegmentedKSpaceTraversal'
    '0018' '9034' 'CS' 'RectilinearPhaseEncodeReordering'
    '0018' '9035' 'FD' 'TagThickness'
    '0018' '9036' 'CS' 'PartialFourierDirection'
    '0018' '9037' 'CS' 'CardiacSynchronizationTechnique'
    '0018' '9041' 'LO' 'ReceiveCoilManufacturerName'
    '0018' '9042' 'SQ' 'MRReceiveCoilSequence'
    '0018' '9043' 'CS' 'ReceiveCoilType'
    '0018' '9044' 'CS' 'QuadratureReceiveCoil'
    '0018' '9045' 'SQ' 'MultiCoilDefinitionSequence'
    '0018' '9047' 'SH' 'MultiCoilElementName'
    '0018' '9048' 'CS' 'MultiCoilElementUsed'
    '0018' '9049' 'SQ' 'MRTransmitCoilSequence'
    '0018' '9050' 'LO' 'TransmitCoilManufacturerName'
    '0018' '9051' 'CS' 'TransmitCoilType'
    '0018' '9052' 'FD' 'SpectralWidth'
    '0018' '9053' 'FD' 'ChemicalShiftReference'
    '0018' '9058' 'US' 'MRAcquisitionFrequencyEncodingSteps'
    '0018' '9059' 'CS' 'Decoupling'
    '0018' '9064' 'CS' 'KSpaceFiltering'
    '0018' '9065' 'CS' 'TimeDomainFiltering'
    '0018' '9066' 'US' 'NumberOfZeroFills'
    '0018' '9067' 'CS' 'BaselineCorrection'
    '0018' '9069' 'FD' 'ParallelReductionFactorInPlane'
    '0018' '9073' 'FD' 'AcquisitionDuration'
    '0018' '9074' 'DT' 'FrameAcquisitionDatetime'
    '0018' '9075' 'CS' 'DiffusionDirectionality'
    '0018' '9076' 'SQ' 'DiffusionGradientDirectionSequence'
    '0018' '9077' 'CS' 'ParallelAcquisition'
    '0018' '9078' 'CS' 'ParallelAcquisitionTechnique'
    '0018' '9079' 'FD' 'InversionTimes'
    '0018' '9080' 'ST' 'MetaboliteMapDescription'
    '0018' '9081' 'CS' 'PartialFourier'
    '0018' '9082' 'FD' 'EffectiveEchoTime'
    '0018' '9087' 'FD' 'B_value' % 'DiffusionBValue'
    '0018' '9089' 'FD' 'DiffusionGradientDirection' % DiffusionGradientOrientation
    '0018' '9090' 'FD' 'VelocityEncodingDirection'
    '0018' '9091' 'FD' 'VelocityEncodingMinimumValue'
    '0018' '9093' 'US' 'NumberOfKSpaceTrajectories'
    '0018' '9094' 'CS' 'CoverageOfKSpace'
    '0018' '9095' 'UL' 'SpectroscopyAcquisitionPhaseRows'
    '0018' '9098' 'FD' 'TransmitterFrequency'
    '0018' '9100' 'CS' 'ResonantNucleus'
    '0018' '9101' 'CS' 'FrequencyCorrection'
    '0018' '9103' 'SQ' 'MRSpectroscopyFOVGeometrySequence'
    '0018' '9104' 'FD' 'SlabThickness'
    '0018' '9105' 'FD' 'SlabOrientation'
    '0018' '9106' 'FD' 'MidSlabPosition'
    '0018' '9112' 'SQ' 'MRTimingAndRelatedParametersSequence'
    '0018' '9114' 'SQ' 'MREchoSequence'
    '0018' '9115' 'SQ' 'MRModifierSequence'
    '0018' '9117' 'SQ' 'MRDiffusionSequence'
    '0018' '9118' 'SQ' 'CardiacTriggerSequence'
    '0018' '9119' 'SQ' 'MRAveragesSequence'
    '0018' '9125' 'SQ' 'MRFOVGeometrySequence'
    '0018' '9127' 'UL' 'SpectroscopyAcquisitionDataColumns'
    '0018' '9147' 'CS' 'DiffusionAnisotropyType'
    '0018' '9151' 'DT' 'FrameReferenceDatetime'
    '0018' '9152' 'SQ' 'MRMetaboliteMapSequence'
    '0018' '9054' 'CS' 'VolumeLocalizationTechnique'
    '0018' '9155' 'FD' 'ParallelReductionFactorOutOfPlane'
    '0018' '9159' 'UL' 'SpectroscopyAcquisitionOutOfPlanePhaseSteps'
    '0018' '9126' 'SQ' 'VolumeLocalizationSequence'
    '0018' '9168' 'FD' 'ParallelReductionFactorSecondInPlane'
    '0018' '9170' 'CS' 'RespiratoryMotionCompensationTechnique'
    '0018' '9171' 'CS' 'RespiratorySignalSource'
    '0018' '9172' 'CS' 'BulkMotionCompensationTechnique'
    '0018' '9174' 'CS' 'ApplicableSafetyStandardAgency'
    '0018' '9176' 'SQ' 'OperatingModeSequence'
    '0018' '9177' 'CS' 'OperatingModeType'
    '0018' '9178' 'CS' 'OperatingMode'
    '0018' '9179' 'CS' 'SpecificAbsorptionRateDefinition'
    '0018' '9180' 'CS' 'GradientOutputType'
    '0018' '9181' 'FD' 'SpecificAbsorptionRateValue'
    '0018' '9182' 'FD' 'GradientOutput'
    '0018' '9183' 'CS' 'FlowCompensationDirection'
    '0018' '9198' 'CS' 'FirstOrderPhaseCorrection'
    '0018' '9199' 'CS' 'WaterReferencedPhaseCorrection'
    '0018' '9200' 'CS' 'MRSpectroscopyAcquisitionType'
    '0018' '9218' 'FD' 'TagSpacingSecondDimension'
    '0018' '9220' 'FD' 'FrameAcquisitionDuration'
    '0018' '9226' 'SQ' 'MRImageFrameTypeSequence'
    '0018' '9227' 'SQ' 'MRSpectroscopyFrameTypeSequence'
    '0018' '9231' 'US' 'MRAcquisitionPhaseEncodingStepsInPlane'
    '0018' '9232' 'US' 'MRAcquisitionPhaseEncodingStepsOutOfPlane'
    '0018' '9234' 'UL' 'SpectroscopyAcquisitionPhaseColumns'
    '0018' '9239' 'SQ' 'SpecificAbsorptionRateSequence'
    '0018' '9240' 'US' 'RFEchoTrainLength'
    '0018' '9241' 'US' 'GradientEchoTrainLength'
    '0018' '9302' 'CS' 'AcquisitionType'
    '0018' '9601' 'SQ' 'DiffusionB_MatrixSequence'
    '0018' '9602' 'FD' 'DiffusionB_ValueXX'
    '0018' '9603' 'FD' 'DiffusionB_ValueXY'
    '0018' '9604' 'FD' 'DiffusionB_ValueXZ'
    '0018' '9605' 'FD' 'DiffusionB_ValueYY'
    '0018' '9606' 'FD' 'DiffusionB_ValueYZ'
    '0018' '9607' 'FD' 'DiffusionB_ValueZZ'
    '0020' '000D' 'UI' 'StudyInstanceUID'
    '0020' '000E' 'UI' 'SeriesInstanceUID'
    '0020' '0010' 'SH' 'StudyID'
    '0020' '0011' 'IS' 'SeriesNumber'
    '0020' '0012' 'IS' 'AcquisitionNumber'
    '0020' '0013' 'IS' 'InstanceNumber'
    '0020' '0020' 'CS' 'PatientOrientation'
    '0020' '0030' 'DS' 'ImagePosition'
    '0020' '0032' 'DS' 'ImagePositionPatient'
    '0020' '0035' 'DS' 'ImageOrientation'
    '0020' '0037' 'DS' 'ImageOrientationPatient'
    '0020' '0052' 'UI' 'FrameOfReferenceUID'
    '0020' '0100' 'IS' 'TemporalPositionIdentifier'
    '0020' '0110' 'DS' 'TemporalResolution'
    '0020' '0105' 'IS' 'NumberOfTemporalPositions'
    '0020' '1000' 'IS' 'SeriesInStudy'
    '0020' '1001' 'IS' 'AcquisitionsInSeries'
    '0020' '1002' 'IS' 'ImagesInAcquisition'
    '0020' '1003' 'IS' 'ImagesInSeries'
    '0020' '1004' 'IS' 'AcquisitionsInStudy'
    '0020' '1005' 'IS' 'ImagesInStudy'
    '0020' '1040' 'LO' 'PositionReferenceIndicator'
    '0020' '1041' 'DS' 'SliceLocation'
    '0020' '4000' 'LT' 'ImageComments'
    '0020' '9056' 'SH' 'StackID'
    '0020' '9057' 'UL' 'InStackPositionNumber'
    '0020' '9071' 'SQ' 'FrameAnatomySequence'
    '0020' '9072' 'CS' 'FrameLaterality'
    '0020' '9111' 'SQ' 'FrameContentSequence'
    '0020' '9113' 'SQ' 'PlanePositionSequence'
    '0020' '9116' 'SQ' 'PlaneOrientationSequence'
    '0020' '9128' 'UL' 'TemporalPositionIndex'
    '0020' '9153' 'FD' 'CardiacTriggerDelayTime'
    '0020' '9156' 'US' 'FrameAcquisitionNumber'
    '0020' '9157' 'UL' 'DimensionIndexValues'
    '0020' '9158' 'LT' 'FrameComments'
    '0020' '9164' 'UI' 'DimensionOrganizationUID'
    '0020' '9165' 'AT' 'DimensionIndexPointer'
    '0020' '9167' 'AT' 'FunctionalGroupPointer'
    '0020' '9221' 'SQ' 'DimensionOrganizationSequence'
    '0020' '9222' 'SQ' 'DimensionIndexSequence'
    '0020' '9251' 'FD' 'RRIntervalTimeMeasured'
    '0020' '9254' 'FD' 'RespiratoryIntervalTime'
    '0020' '9255' 'FD' 'RespiratoryTriggerDelayTime'
    '0020' '9421' 'LO' 'DimensionDescriptionLabel'
    '0028' '0002' 'US' 'SamplesPerPixel'
    '0028' '0004' 'CS' 'PhotometricInterpretation'
    '0028' '0006' 'US' 'PlanarConfiguration'
    '0028' '0008' 'IS' 'NumberOfFrames'
    '0028' '0009' 'AT' 'FrameIncrementPointer'
    '0028' '000A' 'AT' 'FrameDimensionPointer'
    '0028' '0010' 'US' 'Rows'
    '0028' '0011' 'US' 'Columns'
    '0028' '0030' 'DS' 'PixelSpacing'
    '0028' '0034' 'IS' 'PixelAspectRatio'
    '0028' '0051' 'CS' 'CorrectedImage'
    '0028' '0100' 'US' 'BitsAllocated'
    '0028' '0101' 'US' 'BitsStored'
    '0028' '0102' 'US' 'HighBit'
    '0028' '0103' 'US' 'PixelRepresentation'
    '0028' '0104' 'US' 'SmallestValidPixelValue'
    '0028' '0105' 'US' 'LargestValidPixelValue'
    '0028' '0106' 'US' 'SmallestImagePixelValue'
    '0028' '0107' 'US' 'LargestImagePixelValue'
    '0028' '0120' 'SS' 'PixelPaddingValue'
    '0028' '0301' 'CS' 'BurnedInAnnotation'
    '0028' '1050' 'DS' 'WindowCenter'
    '0028' '1051' 'DS' 'WindowWidth'
    '0028' '1052' 'DS' 'RescaleIntercept'
    '0028' '1053' 'DS' 'RescaleSlope'
    '0028' '1054' 'LO' 'RescaleType'
    '0028' '1055' 'LO' 'WindowCenterWidthExplanation'
    '0028' '1080' 'LT' 'GrayScale'
    '0028' '1101' 'US' 'RedPaletteColorLookupTableDescriptor'
    '0028' '1102' 'US' 'GreenPaletteColorLookupTableDescriptor'
    '0028' '1103' 'US' 'BluePaletteColorLookupTableDescriptor'
    '0028' '1201' 'OW' 'RedPaletteColorLookupTableData'
    '0028' '1202' 'OW' 'GreenPaletteColorLookupTableData'
    '0028' '1203' 'OW' 'BluePaletteColorLookupTableData'
    '0028' '2000' 'OB' 'ICCProfile'
    '0028' '2002' 'CS' 'ColorSpace'
    '0028' '2110' 'CS' 'LossyImageCompression'
    '0028' '2112' 'DS' 'LossyImageCompressionRatio'
    '0028' '2114' 'CS' 'LossyImageCompressionMethod'
    '0028' '3003' 'LO' 'LUTExplanation'
    '0028' '9001' 'UL' 'DataPointRows'
    '0028' '9002' 'UL' 'DataPointColumns'
    '0028' '9003' 'CS' 'SignalDomainColumns'
    '0028' '9108' 'CS' 'DataRepresentation'
    '0028' '9110' 'SQ' 'PixelMeasuresSequence'
    '0028' '9132' 'SQ' 'FrameVOILUTSequence'
    '0028' '9145' 'SQ' 'PixelValueTransformationSequence'
    '0032' '000A' 'CS' 'StudyStatusID'
    '0032' '000C' 'CS' 'StudyPriorityID'
    '0032' '1030' 'LO' 'ReasonForStudy'
    '0032' '1032' 'PN' 'RequestingPhysician'
    '0032' '1033' 'LO' 'RequestingService'
    '0032' '1060' 'LO' 'RequestedProcedureDescription'
    '0032' '1064' 'SQ' 'RequestedProcedureCodeSequence'
    '0032' '4000' 'LT' 'StudyComments'
    '0038' '0300' 'LO' 'CurrentPatientLocation'
    '0040' '0006' 'PN' 'ScheduledPerformingPhysicianName'
    '0040' '0007' 'LO' 'ScheduledProcedureStepDescription'
    '0040' '0008' 'SQ' 'ScheduledProtocolCodeSequence'
    '0040' '0009' 'SH' 'ScheduledProcedureStepID'
    '0040' '0241' 'AE' 'PerformedStationAETitle'
    '0040' '0242' 'SH' 'PerformedStationName'
    '0040' '0243' 'SH' 'PerformedLocation'
    '0040' '0244' 'DA' 'PerformedProcedureStepStartDate'
    '0040' '0245' 'TM' 'PerformedProcedureStepStartTime'
    '0040' '0250' 'DA' 'PerformedProcedureStepEndDate'
    '0040' '0251' 'TM' 'PerformedProcedureStepEndTime'
    '0040' '0252' 'CS' 'PerformedProcedureStepStatus'
    '0040' '0253' 'SH' 'PerformedProcedureStepID'
    '0040' '0254' 'LO' 'PerformedProcedureStepDescription'
    '0040' '0260' 'SQ' 'PerformedProtocolCodeSequence'
    '0040' '0275' 'SQ' 'RequestAttributesSequence'
    '0040' '0280' 'ST' 'CommentsOnPerformedProcedureStep'
    '0040' '0321' 'SQ' 'FilmConsumptionSequence'
    '0040' '08EA' 'SQ' 'MeasurementUnitsCodeSequence'
    '0040' '1001' 'SH' 'RequestedProcedureID'
    '0040' '1400' 'LT' 'RequestedProcedureComments'
    '0040' '2004' 'DA' 'IssueDateOfImagingServiceRequest'
    '0040' '2017' 'LO' 'FillerOrderNumberOfImagingServiceRequest'
    '0040' '2400' 'LT' 'ImagingServiceRequestComments'
    '0040' '9096' 'SQ' 'RealWorldValueMappingSequence'
    '0040' '9210' 'SH' 'LUTLabel'
    '0040' '9211' 'SS' 'RealWorldValueLastValueMapped'
    '0040' '9216' 'SS' 'RealWorldValueFirstValueMapped'
    '0040' '9224' 'FD' 'RealWorldValueIntercept'
    '0040' '9225' 'FD' 'RealWorldValueSlope'
    '0040' 'A170' 'SQ' 'PurposeOfReferenceCodeSequence'
    '0050' '0004' 'CS' 'CalibrationImage'
    '0050' '0010' 'SQ' 'DeviceSequence'
    '0050' '0014' 'DS' 'DeviceLength'
    '0050' '0016' 'DS' 'DeviceDiameter'
    '0050' '0017' 'CS' 'DeviceDiameterUnits'
    '0050' '0018' 'DS' 'DeviceVolume'
    '0050' '0019' 'DS' 'InterMarkerDistance'
    '0050' '0020' 'LO' 'DeviceDescription'
    '0088' '0140' 'UI' 'StorageMediaFileSetUID'
    '0088' '0200' 'SQ' 'IconImageSequence'
    '0400' '0550' 'SQ' 'ModifiedAttributesSequence'
    '0400' '0561' 'SQ' 'OriginalAttributesSequence'
    '0400' '0562' 'DT' 'AttributeModificationDatetime'
    '0400' '0563' 'LO' 'ModifyingSystem'
    '0400' '0565' 'CS' 'ReasonForTheAttributeModification'
    '0054' '0016' 'SQ' 'RadiopharmaceuticalInformationSequence'
    '0054' '0081' 'US' 'LocationsInAcquisition' % 'NumberOfSlices'
    '0054' '0101' 'US' 'NumberOfTemporalPositions' % 'NumberOfTimeSlices'
    '0054' '0202' 'CS' 'TypeOfDetectorMotion'
    '0054' '0410' 'SQ' 'PatientOrientationCodeSequence'
    '0054' '0414' 'SQ' 'PatientGantryRelationshipCodeSequence'
    '0054' '1000' 'CS' 'SeriesType'
    '0054' '1001' 'CS' 'Units'
    '0054' '1002' 'CS' 'CountsSource'
    '0054' '1100' 'CS' 'RandomsCorrectionMethod'
    '0054' '1101' 'LO' 'AttenuationCorrectionMethod'
    '0054' '1102' 'CS' 'DecayCorrection'
    '0054' '1103' 'LO' 'ReconstructionMethod'
    '0054' '1105' 'LO' 'ScatterCorrectionMethod'
    '0054' '1300' 'DS' 'FrameReferenceTime'
    '0054' '1321' 'DS' 'DecayFactor'
    '0054' '1330' 'US' 'ImageIndex'
    '0070' '0052' 'SL' 'DisplayedAreaTLHC'
    '0070' '0053' 'SL' 'DisplayedAreaBRHC'
    '0070' '005A' 'SQ' 'DisplayedAreaSelectionSequence'
    '0070' '0080' 'CS' 'ContentLabel'
    '0070' '0081' 'LO' 'ContentDescription'
    '0070' '0082' 'DA' 'PresentationCreationDate'
    '0070' '0083' 'TM' 'PresentationCreationTime'
    '0070' '0100' 'CS' 'PresentationSizeMode'
    '0070' '0101' 'DS' 'PresentationPixelSpacing'
    '0070' '0102' 'IS' 'PresentationPixelAspectRatio'
    '2050' '0020' 'CS' 'PresentationLUTShape'
    '5200' '9229' 'SQ' 'SharedFunctionalGroupsSequence'
    '5200' '9230' 'SQ' 'PerFrameFunctionalGroupsSequence'
    '5600' '0020' 'OF' 'PixelData' % SpectroscopyData
    '7FE0' '0010' 'OW' 'PixelData' };

% Following add vendor specific tags
if strncmpi(vendor, 'SIEMENS', 7)
    C = [C; {
    '0019' '1008' 'CS' 'Private_0019_10xxType'
    '0019' '1009' 'LO' 'Private_0019_10xxVersion'
    '0019' '100A' 'US' 'LocationsInAcquisition' % 'NumberOfImagesInMosaic'
    '0019' '100B' 'DS' 'SliceMeasurementDuration'
    '0019' '100C' 'IS' 'B_value'
    '0019' '100D' 'CS' 'DiffusionDirectionality'
    '0019' '100E' 'FD' 'DiffusionGradientDirection'
    '0019' '100F' 'SH' 'GradientMode'
    '0019' '1011' 'SH' 'FlowCompensation'
    '0019' '1012' 'SL' 'TablePositionOrigin'
    '0019' '1013' 'SL' 'ImaAbsTablePosition'
    '0019' '1014' 'IS' 'ImaRelTablePosition'
    '0019' '1015' 'FD' 'SlicePosition_PCS'
    '0019' '1016' 'DS' 'TimeAfterStart'
    '0019' '1017' 'DS' 'SliceResolution'
    '0019' '1018' 'IS' 'RealDwellTime'
    '0019' '1025' 'DS' 'RBMoCoTrans'
    '0019' '1026' 'DS' 'RBMoCoRot'
    '0019' '1027' 'FD' 'B_matrix'
    '0019' '1028' 'FD' 'BandwidthPerPixelPhaseEncode'
    '0019' '1029' 'FD' 'MosaicRefAcqTimes'
% group 0021 from here by guess
	'0021' '1001' 'IS' 'UsedPatientWeight' % 76
	'0021' '1004' 'DS' 'NumberOfPrescans' % 1 ??
	'0021' '1005' 'IS' 'RelTablePosition' % 0 0 0 ?
	'0021' '1006' 'LO' 'CoilForGradient' % void ? VR not right
	'0021' '1008' 'SH' 'GradientMode' % Fast/Normal ?
	'0021' '1009' 'LO' 'PATModeText' % p2
% 	'0021' '100A' 'DS' 'Private_0021_100a' % 1
% 	'0021' '100D' 'US' 'Private_0021_100d' % 0
	'0021' '100F' 'DS' 'Stim_lim' % 30.312 28.138 29.305 ?
	'0021' '1010' 'IS' 'MrProtocolVersion' % 61010002 ?
% 	'0021' '1011' 'DS' 'Private_0021_1011' % 0
	'0021' '1012' 'FD' 'ReadoutOS' % 2 ?
% 	'0021' '1013' 'DS' 'Private_0021_1013' % 0
% 	'0021' '1014' 'IS' 'Private_0021_1014' % 0
% 	'0021' '1016' 'DS' 'Private_0021_1016' % 0
% 	'0021' '1017' 'DS' 'Private_0021_1017' % 0
	'0021' '1018' 'SH' 'RFSWDMostCriticalAspect' % Head ?
	'0021' '1019' 'CS' 'MrPhoenixProtocol'
% 	'0021' '101B' 'DS' 'Private_0021_101b' % 1
	'0021' '101C' 'DS' 'Stim_max_online' % 17.0793 2.73105 1.00829 ?
% 	'0021' '101D' 'IS' 'Private_0021_101d' % 0
	'0021' '1022' 'SH' 'SequenceFileOwner' % SIEMENS
% 	'0021' '1023' 'IS' 'Private_0021_1023' % 0
	'0021' '1025' 'SL' 'TablePositionOrigin'
	'0021' '1026' 'IS' 'MiscSequenceParam'
% 	'0021' '1027' 'US' 'Private_0021_1027' % 1
	'0021' '102A' 'IS' 'CoilId'
	'0021' '102B' 'ST' 'PatReinPattern'
	'0021' '102C' 'DS' 'Sed' % 14400 367.175 365.369 ?
	'0021' '102D' 'DS' 'SARMostCriticalAspect' % 3.2 0.618899 0.38146 ?
	'0021' '102E' 'IS' 'Stim_mon_mode' % 2 ? or Operation_mode_flag
	'0021' '102F' 'DS' 'GradientDelayTime' % 35 33 29 ??
% 	'0021' '1030' 'DS' 'Private_0021_1030' % 0
	'0021' '1031' 'IS' 'AbsTablePosition' % -1129
% 	'0021' '1032' 'SS' 'Private_0021_1032' % 0
	'0021' '1033' 'SH' 'CoilForGradient2' % GC25 / GC99?
% 	'0021' '1034' 'DS' 'Private_0021_1034' % 1
	'0021' '1035' 'DS' 'Stim_max_ges_norm_online' % 0.572783 ?
% 	'0021' '1036' 'DS' 'Private_0021_1036' % 0
	'0021' '1037' 'SH' 'FlowCompensation' % No ?
	'0021' '1038' 'DS' 'TransmitterCalibration' % 378.488 ?
% 	'0021' '103B' 'DS' 'Private_0021_103b' % 0
	'0021' '103D' 'CS' 'PhaseSliceOversampling' % NONE / 3D ?
	'0021' '1044' 'DS' 'B1rms' % 100 1.09702 ?
	'0021' '1045' 'CS' 'B1rmsSupervision' % YES ?
	'0021' '1046' 'DS' 'TalesReferencePower' % 2333.36 ?
	'0021' '1049' 'CS' 'AcquisitionContrast' % DIFFUSION ?
	'0021' '1050' 'US' 'RFEchoTrainLength' % 1
	'0021' '1051' 'US' 'EchoTrainLength' % 71 ?
	'0021' '1053' 'CS' 'Laterality4MF' % U ?
	'0021' '105A' 'CS' 'ScanningSequence' % EP
	'0021' '105B' 'CS' 'SequenceVariant' % SK\SP
	'0021' '105C' 'CS' 'ScanOptions' % PFP\FS
% 	'0021' '105D' 'SL' 'Private_0021_105d' % -31 / -63
	'0021' '10FE' 'SQ' 'CSASeriesHeaderInfo'
	'0021' '1103' 'DS' 'SliceMeasurementDuration' % 90000 ?
	'0021' '1104' 'DS' 'TimeAfterStart'
	'0021' '1106' 'LO' 'ICE_Dims'
	'0021' '111A' 'SH' 'RFSWDDataType' % measured/predicted
	'0021' '111C' 'IS' 'PhaseEncodingDirectionPositive' % 1/0
	'0021' '1124' 'IS' 'ProtocolSliceNumber' % 0 ?
	'0021' '1133' 'IS' 'EchoLinePosition' % 96 ?
	'0021' '1141' 'SH' 'GSWDDataType' % measured/predicted
	'0021' '1142' 'IS' 'RealDwellTime' % 2400 ?
	'0021' '1145' 'SL' 'AbsTablePosition' % 0 0 -1129
	'0021' '1148' 'IS' 'EchoPartitionPosition' % 32?
	'0021' '1149' 'IS' 'EchoColumnPosition' % 96 ?
	'0021' '114E' 'IS' 'Actual3DImaPartNumber' % 0 ?
	'0021' '114F' 'LO' 'CoilString' % HE1-4
	'0021' '1151' 'UL' 'SequenceMask' % 134217734
	'0021' '1153' 'FD' 'BandwidthPerPixelPhaseEncode'
	'0021' '1156' 'LO' 'PATModeText' % p2
	'0021' '1158' 'SH' 'AcquisitionMatrixText' % 384p*384 I
	'0021' '1159' 'IS' 'RelTablePosition' % 0 0 0 ?
	'0021' '115B' 'FD' 'SlicePosition_PCS'
% 	'0021' '115E' 'IS' 'MeasuredFourierLines' % 0 or MultistepIndex?
	'0021' '1171' 'UT' 'UsedChannelString'
	'0021' '1175' 'CS' 'ImageTypeText'
	'0021' '1176' 'LO' 'ImageHistory'
	'0021' '1177' 'LO' 'SequenceName' % *ep_b1000#12
% 	'0021' '1178' 'CS' 'Private_0021_1178' % ND / DIS2D
% 	'0021' '1179' 'CS' 'Private_0021_1179' % ND / DIS2D
	'0021' '1188' 'DS' 'SliceLocation'
	'0021' '1189' 'FD' 'InversionTimes' % 900 ?
	'0021' '118A' 'IS' 'FrameNumberInSeries' % ? xiangrui names it
	'0021' '11FE' 'SQ' 'CSAImageHeaderInfo'
% 	'0021' '1201' 'LO' 'Private_0021_1201' % ACQUISITION
% 	'0021' '1202' 'LO' 'Private_0021_1202' % ACQUISITION
    '0029' '1008' 'CS' 'CSAImageHeaderType'
    '0029' '1009' 'LO' 'CSAImageHeaderVersion'
    '0029' '1010' 'OB' 'CSAImageHeaderInfo'
    '0029' '1018' 'CS' 'CSASeriesHeaderType'
    '0029' '1019' 'LO' 'CSASeriesHeaderVersion'
    '0029' '1020' 'OB' 'CSASeriesHeaderInfo'
    '0029' '1110' 'OB' 'CSAImageHeaderInfo'
    '0029' '1120' 'OB' 'CSASeriesHeaderInfo'
    '0029' '1131' 'LO' 'PMTFInformation1'
    '0029' '1132' 'UL' 'PMTFInformation2'
    '0029' '1133' 'UL' 'PMTFInformation3'
    '0029' '1134' 'CS' 'PMTFInformation4'
    '0029' '1160' 'LO' 'SeriesWorkflowStatus'
    '0029' '1260' 'LO' 'SeriesWorkflowStatus'
    '0051' '1008' 'CS' 'Private_0051_10xx_Type'
    '0051' '1009' 'LO' 'Private_0051_10xx_Version'
    '0051' '100A' 'LO' 'TimeOfAcquisition'
    '0051' '100B' 'LO' 'AcquisitionMatrixText'
    '0051' '100C' 'LO' 'FieldOfView'
    '0051' '100D' 'SH' 'SlicePositionText'
    '0051' '100E' 'LO' 'ImageOrientation'
    '0051' '100F' 'LO' 'CoilString'
    '0051' '1011' 'LO' 'ImaPATModeText'
    '0051' '1012' 'SH' 'TablePositionText'
    '0051' '1013' 'SH' 'PositivePCSDirections'
    '0051' '1015' 'SH' 'DataFilterText' % not sure
    '0051' '1016' 'LO' 'ImageTypeText'
    '0051' '1017' 'SH' 'SliceThicknessText'
    '0051' '1019' 'LO' 'ScanOptionsText'
    }];
elseif strncmpi(vendor, 'GE', 2)
    C = [C; {
    '0009' '1001' 'LO' 'FullFidelity'
    '0009' '1002' 'SH' 'SuiteId'
    '0009' '1004' 'SH' 'ProductId'
    '0009' '1027' 'SL' 'ImageActualDate'
    '0009' '1030' 'SH' 'ServiceId'
    '0009' '1031' 'SH' 'MobileLocationNumber'
    '0009' '10E3' 'UI' 'EquipmentUID'
    '0009' '10E7' 'UL' 'ExamRecordChecksum'
    '0009' '10E9' 'SL' 'ActualSeriesDataTimeStamp'
    '0019' '100F' 'DS' 'HorizFrameOfRef'
    '0019' '1011' 'SS' 'SeriesContrast'
    '0019' '1012' 'SS' 'LastPseq'
    '0019' '1017' 'SS' 'SeriesPlane'
    '0019' '1018' 'LO' 'FirstScanRas'
    '0019' '1019' 'DS' 'FirstScanLocation'
    '0019' '101A' 'LO' 'LastScanRas'
    '0019' '101B' 'DS' 'LastScanLoc'
    '0019' '101E' 'DS' 'DisplayFieldOfView'
    '0019' '105A' 'FL' 'AcquisitionDuration'
    '0019' '107D' 'DS' 'SecondEcho'
    '0019' '107E' 'SS' 'NumberOfEchoes'
    '0019' '107F' 'DS' 'TableDelta'
    '0019' '1081' 'SS' 'Contiguous'
    '0019' '1084' 'DS' 'PeakSAR'
    '0019' '1085' 'DS' 'MonitorSAR'
    '0019' '1087' 'DS' 'CardiacRepetitionTime'
    '0019' '1088' 'SS' 'ImagesPerCardiacCycle'
    '0019' '108A' 'SS' 'ActualReceiveGainAnalog'
    '0019' '108B' 'SS' 'ActualReceiveGainDigital'
    '0019' '108D' 'DS' 'DelayAfterTrigger'
    '0019' '108F' 'SS' 'Swappf'
    '0019' '1090' 'SS' 'PauseInterval'
    '0019' '1091' 'DS' 'PauseTime'
    '0019' '1092' 'SL' 'SliceOffsetOnFreqAxis'
    '0019' '1093' 'DS' 'AutoPrescanCenterFrequency'
    '0019' '1094' 'SS' 'AutoPrescanTransmitGain'
    '0019' '1095' 'SS' 'AutoPrescanAnalogReceiverGain'
    '0019' '1096' 'SS' 'AutoPrescanDigitalReceiverGain'
    '0019' '1097' 'SL' 'BitmapdefiningCVs'
    '0019' '1098' 'SS' 'CenterFreqMethod'
    '0019' '109B' 'SS' 'PulseSequenceMode'
    '0019' '109C' 'LO' 'PulseSequenceName'
    '0019' '109D' 'DT' 'PulseSequenceDate'
    '0019' '109E' 'LO' 'SequenceName' % 'InternalPulseSequenceName'
    '0019' '109F' 'SS' 'TransmittingCoilType'
    '0019' '10A0' 'SS' 'SurfaceCoilType'
    '0019' '10A1' 'SS' 'ExtremityCoilflag'
    '0019' '10A2' 'SL' 'RawDataRunNumber'
    '0019' '10A3' 'UL' 'CalibratedFieldStrength'
    '0019' '10A4' 'SS' 'SATFatWaterBone'
    '0019' '10A7' 'DS' 'UserData0'
    '0019' '10A8' 'DS' 'UserData1'
    '0019' '10A9' 'DS' 'UserData2'
    '0019' '10AA' 'DS' 'UserData3'
    '0019' '10AB' 'DS' 'UserData4'
    '0019' '10AC' 'DS' 'UserData5'
    '0019' '10AD' 'DS' 'UserData6'
    '0019' '10AE' 'DS' 'UserData7'
    '0019' '10AF' 'DS' 'UserData8'
    '0019' '10B0' 'DS' 'UserData9'
    '0019' '10B1' 'DS' 'UserData10'
    '0019' '10B2' 'DS' 'UserData11'
    '0019' '10B3' 'DS' 'UserData12'
    '0019' '10B4' 'DS' 'UserData13'
    '0019' '10B5' 'DS' 'UserData14'
    '0019' '10B6' 'DS' 'UserData15'
    '0019' '10B7' 'DS' 'UserData16'
    '0019' '10B8' 'DS' 'UserData17'
    '0019' '10B9' 'DS' 'UserData18'
    '0019' '10BA' 'DS' 'UserData19'
    '0019' '10BB' 'DS' 'DiffusionDirectionX' %'UserData20'
    '0019' '10BC' 'DS' 'DiffusionDirectionY' %'UserData21'
    '0019' '10BD' 'DS' 'DiffusionDirectionZ' %'UserData22'
    '0019' '10BE' 'DS' 'ProjectionAngle'
    '0019' '10C0' 'SS' 'SaturationPlanes'
    '0019' '10C2' 'SS' 'SATlocationR'
    '0019' '10C3' 'SS' 'SATlocationL'
    '0019' '10C4' 'SS' 'SATlocationA'
    '0019' '10C5' 'SS' 'SATlocationP'
    '0019' '10C6' 'SS' 'SATlocationH'
    '0019' '10C7' 'SS' 'SATlocationF'
    '0019' '10C8' 'SS' 'SATThicknessRL'
    '0019' '10C9' 'SS' 'SATThicknessAP'
    '0019' '10CA' 'SS' 'SATThicknessHF'
    '0019' '10CB' 'SS' 'PhaseContrastFlowAxis'
    '0019' '10CC' 'SS' 'VelocityEncoding'
    '0019' '10CD' 'SS' 'ThicknessDisclaimer'
    '0019' '10CE' 'SS' 'PrescanType'
    '0019' '10CF' 'SS' 'PrescanStatus'
    '0019' '10D2' 'SS' 'ProjectionAlgorithm'
    '0019' '10D5' 'SS' 'FractionalEcho'
    '0019' '10D7' 'SS' 'CardiacPhaseNumber'
    '0019' '10D8' 'SS' 'VariableEchoflag'
    '0019' '10D9' 'DS' 'ConcatenatedSAT'
    '0019' '10DF' 'DS' 'UserData23'
    '0019' '10E0' 'DS' 'NumberOfDiffusionDirection' %'UserData24'
    '0019' '10E2' 'DS' 'VelocityEncodeScale'
    '0019' '10F2' 'SS' 'FastPhases'
    '0019' '10F9' 'DS' 'TransmitGain'
    '0020' '9301' 'FD' 'ImagePositionPatient' % These 4 are not private
    '0020' '9302' 'FD' 'ImageOrientationPatient' % but seems used only by GE
    '0020' '930E' 'SQ' 'PlanePositionSequence'
    '0020' '930F' 'SQ' 'PlaneOrientationSequence'
    '0021' '1003' 'SS' 'SeriesFromWhichPrescribed'
    '0021' '1035' 'SS' 'SeriesFromWhichPrescribed'
    '0021' '1036' 'SS' 'ImageFromWhichPrescribed'
    '0021' '1037' 'SS' 'ScreenFormat'
    '0021' '104F' 'SS' 'LocationsInAcquisition'
    '0021' '1050' 'SS' 'GraphicallyPrescribed'
    '0021' '1051' 'DS' 'RotationFromSourceXRot'
    '0021' '1052' 'DS' 'RotationFromSourceYRot'
    '0021' '1053' 'DS' 'RotationFromSourceZRot'
    '0021' '1056' 'SL' 'Num3DSlabs'
    '0021' '1057' 'SL' 'LocsPer3DSlab'
    '0021' '1058' 'SL' 'Overlaps'
    '0021' '1059' 'SL' 'ImageFiltering'
    '0021' '105A' 'SL' 'DiffusionDirection'
    '0021' '105B' 'DS' 'TaggingFlipAngle'
    '0021' '105C' 'DS' 'TaggingOrientation'
    '0021' '105D' 'DS' 'TagSpacing'
    '0021' '105E' 'DS' 'RTIA_timer'
    '0021' '105F' 'DS' 'Fps'
    '0021' '1081' 'DS' 'AutoWindowLevelAlpha'
    '0021' '1082' 'DS' 'AutoWindowLevelBeta'
    '0021' '1083' 'DS' 'AutoWindowLevelWindow'
    '0021' '1084' 'DS' 'AutoWindowLevelLevel'
    '0023' '1070' 'FD' 'StartTimeInFirstAxial'
    '0023' '1074' 'SL' 'NumberOfUpdatesToHeader'
    '0023' '107D' 'SS' 'IndicatesStudyHasCompleteInfo'
    '0025' '1006' 'SS' 'LastPulseSequenceUsed'
    '0025' '1007' 'SL' 'ImagesInSeries'
    '0025' '1010' 'SL' 'LandmarkCounter'
    '0025' '1011' 'SS' 'NumberOfAcquisitions'
    '0025' '1014' 'SL' 'IndicatesNumberOfUpdatesToHeader'
    '0025' '1017' 'SL' 'SeriesCompleteFlag'
    '0025' '1018' 'SL' 'NumberOfImagesArchived'
    '0025' '1019' 'SL' 'LastImageNumberUsed'
    '0025' '101A' 'SH' 'PrimaryReceiverSuiteAndHost'
    '0025' '101B' 'OB' 'ProtocolDataBlock'
    '0027' '1006' 'SL' 'ImageArchiveFlag'
    '0027' '1010' 'SS' 'ScoutType'
    '0027' '1031' 'SS' 'ImagingMode'
    '0027' '1032' 'SS' 'PulseSequence'
    '0027' '1033' 'UL' 'ImagingOptions'
    '0027' '1035' 'SS' 'PlaneType'
    '0027' '1040' 'SH' 'RASletterOfImageLocation'
    '0027' '1041' 'FL' 'ImageLocation'
    '0027' '1042' 'FL' 'CenterRCoordOfPlaneImage'
    '0027' '1043' 'FL' 'CenterACoordOfPlaneImage'
    '0027' '1044' 'FL' 'CenterSCoordOfPlaneImage'
    '0027' '1045' 'FL' 'NormalRCoord'
    '0027' '1046' 'FL' 'NormalACoord'
    '0027' '1047' 'FL' 'NormalSCoord'
    '0027' '1060' 'FL' 'ImageDimensionX'
    '0027' '1061' 'FL' 'ImageDimensionY'
    '0027' '1062' 'FL' 'NumberOfExcitations'
    '0029' '1015' 'SL' 'LowerRangeOfPixels1'
    '0029' '1016' 'SL' 'UpperRangeOfPixels1'
    '0029' '1017' 'SL' 'LowerRangeOfPixels2'
    '0029' '1018' 'SL' 'UpperRangeOfPixels2'
    '0029' '1026' 'SS' 'VersionOfTheHdrStruct'
    '0029' '1034' 'SL' 'AdvantageCompOverflow'
    '0029' '1035' 'SL' 'AdvantageCompUnderflow'
    '0043' '1001' 'SS' 'BitmapOfPrescanOptions'
    '0043' '1002' 'SS' 'GradientOffsetInX'
    '0043' '1003' 'SS' 'GradientOffsetInY'
    '0043' '1004' 'SS' 'GradientOffsetInZ'
    '0043' '1006' 'SS' 'NumberOfEPIShots'
    '0043' '1007' 'SS' 'ViewsPerSegment'
    '0043' '1008' 'SS' 'RespiratoryRate'
    '0043' '1009' 'SS' 'RespiratoryTriggerPoint'
    '0043' '100A' 'SS' 'TypeOfReceiverUsed'
    '0043' '100B' 'DS' 'DB_dtPeakRateOfChangeOfGradientField'
    '0043' '100C' 'DS' 'dB_dtLimitsInUnitsOfPercent'
    '0043' '100D' 'DS' 'PSDEstimatedLimit'
    '0043' '100E' 'DS' 'PSDEstimatedLimitInTeslaPerSecond'
    '0043' '1010' 'SS' 'WindowValue'
    '0043' '101C' 'SS' 'GEImageIntegrity'
    '0043' '101D' 'SS' 'LevelValue'
    '0043' '100F' 'DS' 'Saravghead'
    '0043' '1028' 'OB' 'UniqueImageIden'
    '0043' '1029' 'OB' 'HistogramTables'
    '0043' '102A' 'OB' 'UserDefineData'
    '0043' '102B' 'SS' 'PrivateScanOptions'
    '0043' '102C' 'SS' 'EffectiveEchoSpacing'
    '0043' '102D' 'SH' 'FilterMode'
    '0043' '102F' 'SS' 'PrivateImageType'
    '0043' '1030' 'SS' 'VasCollapseFlag'
    '0043' '1032' 'SS' 'VasFlags'
    '0043' '1033' 'FL' 'Neg_scanspacing'
    '0043' '1034' 'IS' 'OffsetFrequency'
    '0043' '1035' 'UL' 'User_usage_tag'
    '0043' '1036' 'UL' 'User_fill_map_MSW'
    '0043' '1037' 'UL' 'User_fill_map_LSW'
    '0043' '1038' 'FL' 'UserData_25_48'
    '0043' '1039' 'IS' 'SlopInt_6_9'
    '0043' '1060' 'IS' 'SlopInt_10_17'
    '0043' '1061' 'UI' 'ScannerStudyEntityUID'
    '0043' '1062' 'SH' 'ScannerStudyID'
    '0043' '106F' 'DS' 'ScannerTableEntry'
    '0043' '1070' 'LO' 'ParadigmName'
    '0043' '1071' 'ST' 'ParadigmDescription'
    '0043' '1072' 'UI' 'ParadigmUID'
    '0043' '1073' 'US' 'ExperimentType'
    '0043' '1074' 'US' 'NumberOfRestVolumes'
    '0043' '1075' 'US' 'NumberOfActiveVolumes'
    '0043' '1076' 'US' 'NumberOfDummyScans'
    '0043' '1079' 'US' 'LocationsInAcquisition' % 'SlicesPerVolume'
    '0043' '107A' 'US' 'ExpectedTimePoints'
    '0043' '107B' 'FL' 'RegressorValues'
    '0043' '107C' 'FL' 'DelayAfterSliceGroup'
    '0043' '107D' 'US' 'ReconModeFlagWord'
    '0043' '1080' 'LO' 'CoilIDData'
    '0043' '1081' 'LO' 'GECoilName'
    '0043' '1082' 'LO' 'SystemConfigurationInformation'
    '0043' '1083' 'DS' 'AssetRFactors'
    '0043' '1084' 'LO' 'AdditionalAssetData'
    '0043' '1088' 'UI' 'PUREAcquisitionCalibrationSeriesUID'
    '0043' '1089' 'LO' 'GoverningBodydB_dtAndSARDefinition'
    '0043' '108A' 'CS' 'InPlanePhaseEncodingDirection'
    '0043' '108B' 'OB' 'FMRIBinaryDataBlock'
    '0043' '1090' 'LO' 'SARDefinition'
    '0043' '1091' 'DS' 'SARValue'
    '0043' '1095' 'LO' 'PrescanReuseString'
    '0043' '1096' 'CS' 'ContentQualification'
    '0043' '1097' 'LO' 'ImageFilteringParameters'
    '0043' '1098' 'UI' 'ASSETAcquisitionCalibrationSeriesUID'
    '0043' '109A' 'IS' 'RxStackIdentification'
    '0043' '10AA' 'LO' 'AdditionalFilteringParameters'
    '0043' '10B3' 'DS' 'AdvancedEddyCorrection' }];
    % SlopInt:
    % 6: b_value 7: private imaging options 2  8: ihtagging  9: ihtagspc
    % 10: ihfcineim  11: ihfcinent  12: Reserved  13: oprtarr
    % 14: averages  15: Current Station #  16: Total # of Stations
    % 17: private imaging options 3

    % ScannerTableEntry:
    % 1: table entry, 2: table swing angle, 3: table lateral offset,
    % 4: gradient coil selected (multiple gradient systems only)
elseif strncmpi(vendor, 'Philips', 7)
    C = [C; {
    '2001' '1001' 'FL' 'ChemicalShift'
    '2001' '1002' 'IS' 'ChemicalShiftNumberMR'
    '2001' '1003' 'FL' 'B_factor'
    '2001' '1004' 'CS' 'DiffusionDirection'
    '2001' '1006' 'CS' 'ImageEnhanced'
    '2001' '1007' 'CS' 'ImageTypeEDES'
    '2001' '1008' 'IS' 'PhaseNumber'
    '2001' '1009' 'FL' 'ImagePrepulseDelay'
    '2001' '100A' 'IS' 'SliceNumberMR'
    '2001' '100B' 'CS' 'SliceOrientation'
    '2001' '100C' 'CS' 'ArrhythmiaRejection'
    '2001' '100E' 'CS' 'CardiacCycled'
    '2001' '100F' 'SS' 'CardiacGateWidth'
    '2001' '1010' 'CS' 'CardiacSync'
    '2001' '1011' 'FL' 'DiffusionEchoTime'
    '2001' '1012' 'CS' 'DynamicSeries'
    '2001' '1013' 'SL' 'EPIFactor'
    '2001' '1014' 'SL' 'NumberOfEchoes'
    '2001' '1015' 'SS' 'NumberOfLocations'
    '2001' '1016' 'SS' 'NumberOfPCDirections'
    '2001' '1017' 'SL' 'NumberOfPhasesMR'
    '2001' '1018' 'SL' 'LocationsInAcquisition'  % 'NumberOfSlicesMR'
    '2001' '1019' 'CS' 'PartialMatrixScanned'
    '2001' '101A' 'FL' 'PCVelocity'
    '2001' '101B' 'FL' 'PrepulseDelay'
    '2001' '101C' 'CS' 'PrepulseType'
    '2001' '101D' 'IS' 'ReconstructionNumberMR'
    '2001' '101F' 'CS' 'RespirationSync'
    '2001' '1020' 'LO' 'ScanningSequence' % ScanningTechnique
    '2001' '1021' 'CS' 'SPIR'
    '2001' '1022' 'FL' 'WaterFatShift'
    '2001' '1023' 'DS' 'MRSeriesFlipAngle' % duplicate
    '2001' '1024' 'CS' 'SeriesIsInteractive'
    '2001' '1025' 'SH' 'EchoTimeDisplay'
    '2001' '102D' 'SS' 'StackNumberOfSlices'
    '2001' '1032' 'FL' 'StackRadialAngle'
    '2001' '1033' 'CS' 'StackRadialAxis'
    '2001' '1035' 'SS' 'StackSliceNumber'
    '2001' '1036' 'CS' 'StackType'
	'2001' '103F' 'CS' 'DisplayedAreaZoomInterpolationMeth'
    '2001' '105F' 'SQ' 'Stack'
    '2001' '1060' 'SL' 'NumberOfStacks'
    '2001' '1061' 'CS' 'SeriesTransmitted'
    '2001' '1062' 'CS' 'SeriesCommitted'
    '2001' '1063' 'CS' 'ExaminationSource'
    '2001' '106E' 'SH' 'SeriesType'
    '2001' '107B' 'IS' 'MRSeriesAcquisitionNumber'
    '2001' '1081' 'IS' 'NumberOfDynamicScans'
    '2001' '1082' 'IS' 'MRSeriesEchoTrainLength' % duplicate
    '2001' '1083' 'DS' 'MRSeriesImagingFrequency' % duplicate
    '2001' '1084' 'DS' 'MRSeriesInversionTime' % duplicate
    '2001' '1085' 'DS' 'MRSeriesMagneticFieldStrength' % duplicate, seems wrong
    '2001' '1086' 'IS' 'MRSeriesNrOfPhaseEncodingSteps' % duplicate, seems wrong
    '2001' '1087' 'SH' 'MRSeriesNucleus' % duplicate
    '2001' '1088' 'DS' 'MRSeriesNumberOfAverages' % duplicate
    '2001' '1089' 'DS' 'MRSeriesPercentPhaseFieldOfView' % duplicate, wrong
    '2001' '108A' 'DS' 'MRSeriesPercentSampling' % duplicate, wrong
    '2001' '108B' 'SH' 'MRSeriesTransmittingCoil' % duplicate
    '2001' '10C8' 'LO' 'ExamCardName'
    '2001' '10F1' 'FL' 'ProspectiveMotionCorrection'
    '2001' '10F2' 'FL' 'RetrospectiveMotionCorrection'
    '2001' '1068' 'CQ' 'LinearModalityGLTrafo'
    '2001' '1077' 'CS' 'GLTrafoType'
    '2001' '9000' 'SQ' 'PresentationStateSequence'
    '2005' '1000' 'FL' 'MRImageAngulationAP'
    '2005' '1001' 'FL' 'MRImageAngulationFH'
    '2005' '1002' 'FL' 'MRImageAngulationRL'
    '2005' '1004' 'CS' 'MRImageDisplayOrientation'
    '2005' '1008' 'FL' 'MRImageOffCentreAP'
    '2005' '1009' 'FL' 'MRImageOffCentreFH'
    '2005' '100A' 'FL' 'MRImageOffCentreRL'
    '2005' '100B' 'FL' 'MRMaxFP'
    '2005' '100C' 'FL' 'MRMinFP'
    '2005' '100D' 'FL' 'MRScaleIntercept'
    '2005' '100E' 'FL' 'MRScaleSlope'
    '2005' '100F' 'DS' 'WindowCenterOriginal'
    '2005' '1010' 'DS' 'WindowWidthOriginal'
    '2005' '1011' 'CS' 'MRImageTypeMR'
    '2005' '1012' 'CS' 'MRCardiacGating'
    '2005' '1013' 'CS' 'MRSeriesDevelopmentMode'
    '2005' '1014' 'CS' 'MRSeriesDiffusion'
    '2005' '1015' 'CS' 'MRFatSaturationTechnique'
    '2005' '1016' 'CS' 'MRFlowCompensation'
    '2005' '1017' 'CS' 'MRFourierInterpolation'
    '2005' '1019' 'CS' 'MRInverseReconstructed'
    '2005' '101A' 'SS' 'MRLabelSyntax'
    '2005' '101B' 'CS' 'MRMagnetiPrepared'
    '2005' '101C' 'CS' 'MRMagnetTransferConst'
    '2005' '101D' 'SS' 'MRMeasurementScanResolution'
    '2005' '101E' 'SH' 'MIPProtocol'
    '2005' '101F' 'SH' 'MPRProtocol'
    '2005' '1020' 'SL' 'NumberOfChemicalShift'
    '2005' '1021' 'SS' 'MRNumberOfMixes'
    '2005' '1022' 'IS' 'MRNumberOfReferences'
    '2005' '1023' 'SS' 'MRNumberOfSlabs'
    '2005' '1025' 'SS' 'MRNumberOfVolumes'
    '2005' '1026' 'CS' 'MROverSampleingPhase'
    '2005' '1027' 'CS' 'MRPackageMode'
    '2005' '1028' 'CS' 'MRPartialFourierFrequency'
    '2005' '1029' 'CS' 'MRPartialFourierPhase'
    '2005' '102A' 'IS' 'MRPatientReferenceID'
    '2005' '102B' 'SS' 'MRPercentScanComplete'
    '2005' '102C' 'CS' 'MRPhaseEncodedRecording'
    '2005' '102D' 'IS' 'MRPlanScanSurveyNumberOfImages'
    '2005' '102E' 'CS' 'MRPPGPPUGating'
    '2005' '102F' 'CS' 'MRSpatialPresaturation'
    '2005' '1030' 'FL' 'MRSeriesRepetitionTime' % duplicate
    '2005' '1031' 'CS' 'MRRespiratoryGating'
    '2005' '1033' 'FL' 'MRSeriesScanDuration'
    '2005' '1034' 'CS' 'MRSegmentedKSpace'
    '2005' '1035' 'CS' 'MRSeriesDataType'
    '2005' '1036' 'CS' 'MRSeriesIsCardiac'
    '2005' '1037' 'CS' 'MRSeriesIsSpectro'
    '2005' '1038' 'CS' 'MRSpoiled'
    '2005' '1039' 'CS' 'MRSteadyState'
    '2005' '103A' 'SH' 'MRSubAnatomy'
    '2005' '103B' 'CS' 'MRTimeReversedSteadyState'
    '2005' '103C' 'CS' 'MRSeriesTone'
    '2005' '103D' 'SS' 'MRNumberOfRRIntervalRanges'
    '2005' '103E' 'SL' 'MRRRIntervalsDistribution'
    '2005' '103F' 'SL' 'MRPlanScanAcquisitionNo'
    '2005' '1040' 'SL' 'MRChemicalShiftNo'
    '2005' '1041' 'SL' 'MRPlanScanDynamicScanNo'
    '2005' '1042' 'SL' 'MRPlanScanSurveyEchoNo'
    '2005' '1043' 'CS' 'MRPlanScanImageType'
    '2005' '1044' 'SL' 'MRPlanScanPhaseNo'
    '2005' '1045' 'SL' 'MRPlanScanReconstructionNo'
    '2005' '1046' 'CS' 'MRPlanScanScanningSequence'
    '2005' '1047' 'SL' 'MRPlanScanSliceNo'
    '2005' '1054' 'FL' 'MRVolumeAngulationAP'
    '2005' '1055' 'FL' 'MRVolumeAngulationFH'
    '2005' '1056' 'FL' 'MRVolumeAngulationRL'
    '2005' '1057' 'FL' 'MRVolumeFovAP'
    '2005' '1058' 'FL' 'MRVolumeFovFH'
    '2005' '1059' 'FL' 'MRVolumeFovRL'
    '2005' '105A' 'FL' 'MRVolumeOffcentreAP'
    '2005' '105B' 'FL' 'MRVolumeOffcentreFH'
    '2005' '105C' 'FL' 'MRVolumeOffcentreRL'
    '2005' '105D' 'CS' 'MRVolumeType'
    '2005' '105E' 'CS' 'MRVolumeViewAxis'
    '2005' '105F' 'CS' 'MRStudyOrigin'
    '2005' '1060' 'IS' 'MRStudySequenceNumber'
    '2005' '1061' 'CS' 'MRImagePrepulseType'
    '2005' '1063' 'SS' 'MRfMRIStatusIndication'
    '2005' '106E' 'CS' 'MRImageScanningSequencePrivate'
    '2005' '106F' 'CS' 'MRAcquisitionType' % 'MRSeriesAcquisitionTypePrivate'
    '2005' '1071' 'FL' 'MRStackAngulationAP'
    '2005' '1072' 'FL' 'MRStackAngulationFH'
    '2005' '1073' 'FL' 'MRStackAngulationRL'
    '2005' '1074' 'FL' 'MRStackFovAP'
    '2005' '1075' 'FL' 'MRStackFovFH'
    '2005' '1076' 'FL' 'MRStackFovRL'
    '2005' '1078' 'FL' 'MRStackOffcentreAP'
    '2005' '1079' 'FL' 'MRStackOffcentreFH'
    '2005' '107A' 'FL' 'MRStackOffcentreRL'
    '2005' '107B' 'CS' 'MRStackPreparationDirection'
    '2005' '107E' 'FL' 'MRStackSliceDistance'
    '2005' '1080' 'SQ' 'SeriesPlanScan'
    '2005' '1081' 'CS' 'MRStackViewAxis'
    '2005' '1083' 'SQ' 'SeriesSlab'
    '2005' '1084' 'SQ' 'SeriesReference'
    '2005' '1085' 'SQ' 'SeriesVolume'
    '2005' '1086' 'SS' 'MRNumberOfGeometry'
    '2005' '109E' 'SQ' 'SeriesGeom'
    '2005' '109F' 'CS' 'MRSeriesSpectralSelectiveExcitationPulse'
    '2005' '10A0' 'FL' 'MRImageDynamicScanBeginTime'
    '2005' '10A1' 'CS' 'SyncraScanType'
    '2005' '10A2' 'CS' 'MRIsCOCA'
    '2005' '10A3' 'IS' 'MRStackCoilID'
    '2005' '10A4' 'IS' 'MRStackCBBCoil1'
    '2005' '10A5' 'IS' 'MRStackCBBCoil2'
    '2005' '10A6' 'IS' 'MRStackChannelCombi'
    '2005' '10A7' 'CS' 'MRStackCoilConn'
    '2005' '10A8' 'DS' 'MRPrivateInversionTime'
    '2005' '10A9' 'CS' 'MRSeriesGeometryCorrection'
    '2005' '10B0' 'FL' 'DiffusionDirectionX' % degrees
    '2005' '10B1' 'FL' 'DiffusionDirectionY'
    '2005' '10B2' 'FL' 'DiffusionDirectionZ'
    '2005' '10C0' 'CS' 'SequenceVariant' % 'SeriesScanSequence' % duplicate
    '2005' '1132' 'SQ' 'MRBlobDataObjectArray'
    '2005' '1134' 'LT' 'SeriesTransactionUID'
    '2005' '1137' 'PN' 'MRBlobName'
%     '2005' '1138' 'PN' 'MRApplicationName'
    '2005' '1139' 'PN' 'MRTypeName'
%     '2005' '1140' 'PN' 'MRVersionStr'
%     '2005' '1141' 'PN' 'MRCommentStr'
%     '2005' '1142' 'CS' 'BlobInFile'
    '2005' '1143' 'SL' 'MRActualBlobSize'
    '2005' '1144' 'OW' 'MRBlobData'
    '2005' '1145' 'PN' 'BlobFilename'
%     '2005' '1146' 'SL' 'BlobOffset'
    '2005' '1147' 'CS' 'MRBlobFlag'
    '2005' '1199' 'UL' 'MRNumberOfRequestExcerpts'
    '2005' '1200' 'UL' 'MRNumberOfSOPCommon'
    '2005' '1201' 'UL' 'MRNoOfFilmConsumption'
    '2005' '1213' 'UL' 'MRNumberOfCodes'
    '2005' '1234' 'SL' 'MRNumberOfImagePerSeriesRef'
	'2005' '1257' 'SS' 'MRNrRunningAttributes'
    '2005' '1243' 'SS' 'MRNoDateOfLastCalibration'
    '2005' '1244' 'SS' 'MRNoTimeOfLastCalibration'
    '2005' '1245' 'SS' 'MRNrOfSoftwareVersion'
    '2005' '1247' 'SS' 'MRNrOfPatientOtherNames'
    '2005' '1248' 'SS' 'MRNrOfReqRecipeOfResults'
    '2005' '1249' 'SS' 'MRNrOfSeriesOperatorsName'
    '2005' '1250' 'SS' 'MRNrOfSeriesPerfPhysiName'
    '2005' '1251' 'SS' 'MRNrOfStudyAdmittingDiagnosticDescr'
    '2005' '1252' 'SS' 'MRNrOfStudyPatientContrastAllergies'
    '2005' '1253' 'SS' 'MRNrOfStudyPatientMedicalAlerts'
    '2005' '1254' 'SS' 'MRNrOfStudyPhysiciansOfRecord'
    '2005' '1255' 'SS' 'MRNrOfStudyPhysiReadingStudy'
    '2005' '1256' 'SS' 'MRNrSCSoftwareVersions'
    '2005' '1325' 'CS' 'MRSpectroSIB0Correction'
    '2005' '1326' 'FL' 'MRSpectroB0EchoTopPosition'
    '2005' '1327' 'CS' 'MRSpectroComplexComponent'
    '2005' '1328' 'CS' 'MRSpectroDataOrigin'
    '2005' '1329' 'FL' 'MRSpectroEchoTopPosition'
    '2005' '1330' 'CS' 'MRInPlaneTransforms'
    '2005' '1331' 'SS' 'MRNumberOfSpectraAcquired'
    '2005' '1333' 'FL' 'MRPhaseEncodingEchoTopPositions'
    '2005' '1334' 'CS' 'MRPhysicalQuantityForChemicalShift'
    '2005' '1335' 'CS' 'MRPhysicalQuantitySpatial'
    '2005' '1336' 'FL' 'MRReferenceFrequency'
    '2005' '1337' 'FL' 'MRSampleOffset'
    '2005' '1338' 'FL' 'MRSamplePitch'
    '2005' '1339' 'SS' 'MRSearchIntervalForPeaks'
    '2005' '1340' 'CS' 'MRSignalDomainForChemicalShift'
    '2005' '1341' 'CS' 'MRSignalDomainSpatial'
    '2005' '1342' 'CS' 'MRSignalType'
    '2005' '1343' 'CS' 'MRSpectroAdditionalRotations'
    '2005' '1344' 'SS' 'MRSpectroDisplayRanges'
    '2005' '1345' 'CS' 'MRSpectroEchoAcquisition'
    '2005' '1346' 'CS' 'MRSpectroFrequencyUnit'
    '2005' '1347' 'FL' 'MRSpectroGamma'
    '2005' '1348' 'CS' 'MRSpectroHiddenLineRemoval'
    '2005' '1349' 'FL' 'MRSpectroHorizontalShift'
    '2005' '1350' 'FL' 'MRSpectroHorizontalWindow'
    '2005' '1351' 'SS' 'MRSpectroNumberOfDisplayRanges'
    '2005' '1352' 'SS' 'MRSpectroNumberOfEchoPulses'
    '2005' '1353' 'LO' 'MRSpectroProcessingHistory'
    '2005' '1354' 'CS' 'MRSpectroScanType'
    '2005' '1355' 'FL' 'MRSpectroSICSIntervals'
    '2005' '1356' 'CS' 'MRSpectroSIMode'
    '2005' '1357' 'SS' 'MRSpectroSpectralBW'
    '2005' '1358' 'LO' 'MRSpectroTitleLine'
    '2005' '1359' 'FL' 'MRSpectroTurboEchoSpacing'
    '2005' '1360' 'FL' 'MRSpectroVerticalShift'
    '2005' '1361' 'FL' 'MRSpectroVerticalWindow'
    '2005' '1362' 'FL' 'MRSpectroOffset'
    '2005' '1363' 'FL' 'MRSpectrumPitch'
    '2005' '1364' 'CS' 'MRVolumeSelection'
    '2005' '1370' 'SS' 'MRNoMixesSpectro'
    '2005' '1371' 'SQ' 'MRSeriesSPMix'
    '2005' '1381' 'IS' 'MRScanoGramSurveyNumberOfImages'
    '2005' '1382' 'UL' 'MRNumberOfProcedureCodes'
    '2005' '1389' 'SQ' 'ViewingProtocol'
    '2005' '1390' 'CS' 'MRStackCoilFunction'
    '2005' '1392' 'IS' 'MRGeolinkID'
    '2005' '1393' 'IS' 'MRStationNo'
    '2005' '1395' 'UI' 'ViewProcedureString'
    '2005' '1396' 'CS' 'MRFlowImagesPresent'
    '2005' '1397' 'LO' 'AnatomicRegCodeValue'
    '2005' '1398' 'CS' 'MRMobiviewEnabled'
    '2005' '1399' 'CS' 'MRIViewBoldEnabled'
    '2005' '1400' 'CS' 'MRVolumeViewEnabled'
    '2005' '1401' 'UL' 'MRNumberOfStudyReference'
    '2005' '1402' 'SQ' 'SPSCode'
    '2005' '1403' 'UL' 'MRNumberOfSPSCodes'
    '2005' '1407' 'SS' 'MRNrOfSpecificCharacterSet'
    '2005' '1409' 'DS' 'RescaleInterceptOriginal'
    '2005' '140A' 'DS' 'RescaleSlopeOriginal'
    '2005' '140B' 'LO' 'RescaleTypeOriginal'
    '2005' '140E' 'SQ' 'PrivateSharedSq'
    '2005' '140F' 'SQ' 'PrivatePerFrameSq'
    '2005' '1410' 'IS' 'MFConvTreatSpectorMixNo'
    '2005' '1411' 'UI' 'MFPrivateReferencedSOPInstanceUID'
    '2005' '1412' 'IS' 'MRImageDiffBValueNumber'
    '2005' '1413' 'IS' 'MRImageGradientOrientationNumber'
    '2005' '1414' 'SL' 'MRSeriesNrOfDiffBValues'
    '2005' '1415' 'SL' 'MRSeriesNrOfDiffGradOrients'
    '2005' '1416' 'CS' 'MRSeriesPlanMode'
    '2005' '1417' 'FD' 'B_matrix' % DiffusionBMatrix
    '2005' '1418' 'CS' 'PrivOperatingModeType'
    '2005' '1419' 'CS' 'PrivOperatingMode'
    '2005' '141A' 'CS' 'MRFatSaturationTechnique'
    '2005' '141B' 'IS' 'MRVersionNumberDeletedImages'
    '2005' '141C' 'IS' 'MRVersionNumberDeletedSpectra'
    '2005' '141D' 'IS' 'MRVersionNumberDeletedBlobsets'
    '2005' '1426' 'CS' 'ViewingHardcopyOnly'
    '2005' '1428' 'SL' 'MRSeriesNrOfLabelTypes'
    '2005' '142A' 'CS' 'ExamPrintStatus'
    '2005' '142B' 'CS' 'ExamExportStatus'
    '2005' '142C' 'CS' 'ExamStorageCommitStatus'
    '2005' '142D' 'CS' 'ExamMediaWriteStatus'
    '2005' '142E' 'FL' 'MRSeriesDBdt'
    '2005' '142F' 'FL' 'MRSeriesProtonSAR'
    '2005' '1430' 'FL' 'MRSeriesNonProtonSAR'
    '2005' '1431' 'FL' 'MRSeriesLocalSAR'
    '2005' '1432' 'CS' 'MRSeriesSafetyOverrideMode'
    '2005' '1435' 'CS' 'SpectroExamcard'
    '2005' '143A' 'LT' 'DataDictionaryContentsVersion'
    '2005' '143B' 'CS' 'MRIsCoilSurvey'
    '2005' '143C' 'FL' 'MRStackTablePosLong'
    '2005' '143D' 'FL' 'MRStackTablePosLat'
    '2005' '143E' 'FL' 'MRStackPosteriorCoilPos'
    '2005' '143F' 'CS' 'AIMDLimitsApplied'
    '2005' '1440' 'FL' 'AIMDHeadSARLimit'
    '2005' '1441' 'FL' 'AIMDWholeBodySARLimit'
    '2005' '1442' 'FL' 'AIMDB1RMSLimit'
    '2005' '1443' 'FL' 'AIMDdbDtLimit'
    '2005' '1444' 'IS' 'TFEFactor'
    '2005' '1445' 'CS' 'AttenuationCorrection'
    '2005' '1446' 'FL' 'FWHMShim'
    '2005' '1447' 'FL' 'PowerOptimization'
    '2005' '1448' 'FL' 'CoilQ'
    '2005' '144A' 'FL' 'DataWindowDuration'
    '2005' '144B' 'FL' 'MixingTime'
    '2005' '144C' 'FL' 'FirstEchoTime'
    '2005' '144D' 'CS' 'IsB0Series'
    '2005' '144E' 'CS' 'IsB1Series'
    '2005' '144F' 'CS' 'VolumeSelect'
    '2005' '1450' 'SS' 'MRNrOfPatientOtherIDs'
    '2005' '1455' 'FD' 'ImageVelocityEncodingDirection'
    '2005' '1492' 'FL' 'SpecificEnergyDose'
    '2005' '1553' 'FL' 'MREFrequency'
    '2005' '1554' 'FL' 'MREAmplitude'
    '2005' '1555' 'FL' 'MREMEGFrequency'
    '2005' '1556' 'FL' 'MREMEGPairs'
    '2005' '1557' 'CS' 'MREMEGDirection'
    '2005' '1558' 'FL' 'MREMEGAmplitude'
    '2005' '1559' 'FL' 'MRENumberofPhaseDelays'
    '2005' '1560' 'IS' 'MRENumberofMotionCycles'
    '2005' '1561' 'FL' 'MREMotionMegPhaseDelay'
    '2005' '1562' 'LT' 'MREInversionAlgorithmVersion'
    '2005' '1568' 'IS' 'MREPhaseDelayNumber'
    '2005' '1563' 'CS' 'SagittalSliceOrder'
    '2005' '1564' 'CS' 'CoronalSliceOrder'
    '2005' '1565' 'CS' 'TransversalSliceOrder'
    '2005' '1566' 'CS' 'SeriesOrientation'
    '2005' '1567' 'IS' 'MRStackReverse'
    '2005' '1579' 'CS' 'OrientationMirrorFlip'
    '2005' '1571' 'IS' 'NumberOfInversionDelays'
    '2005' '1572' 'FL' 'InversionDelayTime'
    '2005' '1573' 'IS' 'InversionDelayNumber'
    '2005' '1574' 'DS' 'MaxDBDT'
    '2005' '1575' 'DS' 'MaxSAR'
    '2005' '1576' 'LT' 'SARType'
    '2005' '1578' 'CS' 'MetalImplantStatus'
    '2005' '1581' 'CS' 'SAROperationMode'
    '2005' '1582' 'IS' 'SpatialGradient'
    '2005' '1583' 'LT' 'AdditionalConstraints'
    '2005' '1585' 'DS' 'PIIM_GRADIENT_SLEW_RATE'
    '2005' '1587' 'DS' 'PIIM_MR_STUDY_B1RMS'
    '2050' '0020' 'CS' 'PresentationLUTShape' }];
elseif strncmpi(vendor, 'UIH', 3)
    C = [C; {
    '0061' '1002' 'US' 'GeneratePrivate'
    '0061' '4002' 'SH' 'FOV'
    '0065' '1000' 'UL' 'MeasurmentUID'
    '0065' '1002' 'SH' 'ImageOrientationDisplayed'
    '0065' '1003' 'LO' 'ReceiveCoil'
    '0065' '1004' 'SH' 'Interpolation'
    '0065' '1005' 'SH' 'PEDirectionDisplayed'
    '0065' '1006' 'IS' 'SliceGroupID'
    '0065' '1007' 'OB' 'Uprotocol'
    '0065' '1009' 'FD' 'B_value' % 'BActualValue'
    '0065' '100A' 'FD' 'BUserValue'
    '0065' '100B' 'DS' 'BlockSize'
    '0065' '100C' 'SH' 'ExperimentalStatus'
    '0065' '100D' 'SH' 'ParallelInformation'
    '0065' '100F' 'SH' 'SlicePosition'
    '0065' '1011' 'SH' 'Sections'
    '0065' '1013' 'FD' 'InPlaneRotAngle'
    '0065' '1014' 'DS' 'SliceNormalVector'
    '0065' '1015' 'DS' 'SliceCenterPosition'
    '0065' '1016' 'UL' 'PixelRotateModel'
    '0065' '1017' 'LO' 'SARModel'
    '0065' '1018' 'LO' 'dBdtModel'
    '0065' '1023' 'LO' 'TablePosition'
    '0065' '1025' 'DS' 'SliceGap'
    '0065' '1029' 'SH' 'AcquisitionDurationUIH'
    '0065' '102B' 'LT' 'ApplicationCategory'
    '0065' '102C' 'IS' 'RepeatitionIndex'
    '0065' '102D' 'ST' 'SequenceDisplayName'
    '0065' '102E' 'LO' 'NoiseDecovarFlag'
    '0065' '102F' 'FL' 'ScaleFactor'
    '0065' '1031' 'SH' 'MRSequenceVariant'
    '0065' '1032' 'SH' 'MRKSpaceFilter'
    '0065' '1033' 'SH' 'MRTableMode'
    '0065' '1036' 'OB' 'MRDiscoParameter'
    '0065' '1037' 'FD' 'MRDiffusionGradOrientation'
    '0065' '1038' 'FD' 'MRPerfusionNoiseLevel'
    '0065' '1039' 'SH' 'MRGradRange'
    '0065' '1050' 'DS' 'LocationsInAcquisition' % MRNumberOfSliceInVolume
    '0065' '1051' 'SQ' 'MRVFrameSequence'}];
% elseif strncmpi(vendor, 'OtherVendor', n)
%     C = [C; {}];
end

dict.group = uint16(hex2dec(C(:,1)));
dict.element = uint16(hex2dec(C(:,2)));
dict.tag = uint32(dict.group) * 65536 + uint32(dict.element);
dict.vr = C(:,3); % for implicit VR and some problematic explicit VR
dict.name = C(:,4);

if nargin>1 && ~isempty(flds) % use only provided fields
    flds = cellstr(flds);
    ind = false(size(dict.tag,1), 1);
    for i = 1:numel(flds)
        ind = ind | strcmp(flds{i}, dict.name); % include duplicate
    end
    dict.fields = flds; % remember the requested fields
    dict.tag  = dict.tag(ind);
    dict.vr   = dict.vr(ind);
    dict.name = dict.name(ind);
    dict.group = dict.group(ind);
    dict.element = dict.element(ind);
end

[dict.tag, ind] = unique(dict.tag); % sort by tag
dict.vr = dict.vr(ind);
dict.name = dict.name(ind);
dict.group = dict.group(ind);
dict.element = dict.element(ind);


function [mv] = mv_openFig(mv);
% mv_openFig(view, voxels, scans, dt, ROIname);
%
% For MultiVoxel UI: Open the interface figure,  attaching
% menus and updating the mv data structure. (Use
% er_voxelData to get an mv structure from a mrVista
% ROI).
%
%
%
% ras,  04/05

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% open figure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figName = sprintf('%s Voxel Data  [scans %s,  session %s]', ...
                   mv.roi.name, num2str(mv.params.scans), ...
                   mv.params.sessionCode);,

mv.ui.fig = figure('Name', figName, ...
           'Units', 'Normalized', ...
           'Position', [0.2 0.4 0.4 0.4], ...
           'MenuBar', 'none', ...
           'NumberTitle', 'off', ...
           'Color', 'w');

% add menus
mv = mv_plotsMenu(mv, mv.ui.fig);
mv = mv_viewMenu(mv, mv.ui.fig);
mv = mv_analysisMenu(mv, mv.ui.fig);
mv = mv_settingsMenu(mv, mv.ui.fig);
mv = mv_xformMenu(mv, mv.ui.fig);
mv = mv_conditionsMenu(mv, mv.ui.fig);
mv = mv_helpMenu(mv, mv.ui.fig);

% add a control panel for visualizing GLMs (maybe other things too)
mv = mv_glmPanel(mv);

% clear axes
cla;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% set mv struct as userdata of fig
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(mv.ui.fig, 'UserData', mv);

return


function setfotnsizefigure(fontsize)
set(get(gca,'XLabel'),'FontSize',fontsize)
set(get(gca,'YLabel'),'FontSize',fontsize)
set(gca,'FontSize',fontsize)


function TF = antelope_exists()

%ANTELOPE_EXISTS check for Antelope Toolbox for Matlab
%  TF = ANTELOPE_EXISTS returns 1 if the Antelope Toolbox for Matlab is
%  present in the Matlab path. This function does not check to see whether
%  the Antelope Toolbox is functioning correctly. It merely searches the
%  path for the existence of certain functions. To test the actual validity
%  of the Antelope toolbox you might try the example suite executed by
%  dbexample_runall (an example in the Antelope Toolbox for Matlab). The
%  Antelope Toolbox for Matlab is not part of GISMO though GISMO includes
%  many utilities built on the toolbox. It is maintained by Lindquist
%  Consulting, Inc.

% Author: Michael West, Geophysical Institute, Univ. of Alaska Fairbanks
% $Date$
% $Revision$

if exist('dbopen','file') && exist('trload_css','file');
    TF = 1;
else
    TF = 0;
end


function [ spath ] = tokens2path( tokens )
%TOKENS2PATH Summary of this function goes here
%   Detailed explanation goes here

    spath = tokens{1};

    for i = 2 : numel(tokens)
        spath = [spath '/' tokens{i}];
    end;

end


function l = readascii(filename)

% l = readascii(filename)
% read each line of an ASCII file into list l

l = list;		% create empty list
fid = fopen(filename, 'r');

if fid ~= -1
	while 1
		line = fgetl(fid);
		if ~isstr(line), break, end
			l = TSTL_append(l, line);
		end
	fclose(fid);
end


function y = cvx_subsasgn( y, varargin )
temp.type = '()';
temp.subs = varargin(1:end-1);
y = subsasgn( y, temp, varargin{end} );

% Copyright 2010 Michael C. Grant and Stephen P. Boyd.
% See the file COPYING.txt for full copyright information.
% The command 'cvx_where' will show where this file is located.


%DRAWCHESSBOARDCORNERS  Renders the detected chessboard corners
%
%     im = cv.drawChessboardCorners(im, patternSize, corners)
%     im = cv.drawChessboardCorners(..., 'OptionName', optionValue, ...)
%
% ## Input
% * __im__ Source image. It must be an 8-bit color image.
% * __patternSize__ Number of inner corners per a chessboard row and column
%   (`patternSize = [points_per_row, points_per_column]`).
% * __corners__ Array of detected corners, the output of
%   cv.findChessboardCorners.
%
% ## Output
% * __im__ Destination image.
%
% ## Options
% * __PatternWasFound__ Parameter indicating whether the complete board was
%   found or not. The return value of cv.findChessboardCorners should be
%   passed here. default true
%
% The function draws individual chessboard corners detected either as red
% circles if the board was not found, or as colored corners connected with
% lines if the board was found.
%
% See also: cv.findChessboardCorners, cv.findCirclesGrid
%


function id = generatejobid(batch, batchid)

% GENERATEJOBID generates a unique identifier for a job to be submitted to the
% batch queueing system. It maintains an internal counter to allow it to be
% called from multiple qsubfeval instances without the user having to keep
% track of the numbers.
%
% Use as
%   jobid     = generatejobid(batch)
%   batchid   = generatebatchid(batch)
%   sessionid = generatesessionid()
%
% The result is a string like
%   user_host_pid_bM_jN  % as jobid
%   user_host_pid_bM     % as batchid
%   user_host_pid        % as sessionid
% where M is the batch number and N the sequential job number (per batch).
%
% Besides specifying a batch number, it is also possible to specify the full
% batch name as string. This allows the user to override the default
% user_host_pid_bM part of the jobid. This works like
%   jobid     = generatejobid(batch, batchid)
% where for example generatejobid(1, 'freqanalysis') returns the sequence
% of strings 'freqanalysis_j001', 'freqanalysis_j002', ...
%
% See also GENERATEBATCHID, GENERATESESSIONID

% Copyright (C) 2011-2012, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
%    FieldTrip is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    FieldTrip is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

% jobNum will be a vector with one entry for each batch number
persistent jobNum

if nargin<1
  error('incorrect number of input arguments');
end

if nargin<2
  batchid = [];
end

if length(jobNum)>=batch
  % increment the previous value
  job = jobNum(batch)+1;
else
  % start with job number one
  job = 1;
end

if ~isempty(batchid)
  id = sprintf('%s_j%03d', batchid, job);
else
  id = sprintf('%s_%s_p%d_b%d_j%03d', getusername(), gethostname(), getpid(), batch, job);
end

% ensure that it can be used as filename, struct fieldname, etc.
id = fixname(id);

% remember the current job number for the current batch
jobNum(batch) = job;


classdef ECGtask_Delineation_corrector < ECGtask

% ECGtask for ECGwrapper (for Matlab)
% ---------------------------------
%
% Description:
%
% Abstract class for defining ECGtask interface
%
%
% Author: Mariano Llamedo Soria (llamedom at frba.utn.edu.ar)
% Version: 0.1 beta
% Birthdate  : 18/2/2013
% Last update: 18/2/2013

    properties(GetAccess = public, Constant)
        name = 'Delineation_corrector';
        % Require the parent Wrapper object to this task
        target_units = 'Wrapper';
        doPayload = true;
    end

    properties( GetAccess = public, SetAccess = private)
        % if user = memory;
        % memory_constant is the fraction respect to user.MaxPossibleArrayBytes
        % which determines the maximum input data size.
        % Size > 1 means that this task can handle big data structures, as
        % this case.
        memory_constant = realmax;
        started = false;
    end

    properties( Access = private, Constant)

        fig_hdl = 1;
        cAnnotationOutputFields = { 'Pon' 'P' 'Poff' 'QRSon' 'Q' 'R' 'S' 'QRSoff' 'Ton' 'T' 'Toff'};

    end

    properties( Access = private )

    end

    properties

        progress_handle
        caller_variable = 'payload';
        tmp_path
        payload

    end

    methods

        function obj = ECGtask_QRS_detection(obj)

            obj.wavedet_config.setup.wavedet.QRS_detection_only = true;

        end

        function Start(obj, ECG_header, ECG_annotations)

            obj.started = true;

        end

        function payload = Process(obj, ECG, ECG_start_offset, ECG_sample_start_end_idx, ECG_header, ECG_annotations, ECG_annotations_start_end_idx )

            payload = [];

            obj.progress_handle.hide()

%             if( ~obj.started )
%                 obj.Start(ECG_header);
%                 if( ~obj.started )
%                     cprintf('*[1,0.5,0]', 'Task %s unable to be started for %s.\n', obj.name, ECG_header.recname);
%                     return
%                 end
%             end

            this_start_end = (ECG_sample_start_end_idx + ECG_start_offset - 1);
            aux_val = this_start_end ./ ECG_header.freq;
%             disp_string_title(1, sprintf( 'Correcting from %s to %s', Seconds2HMS(aux_val(1)), Seconds2HMS(aux_val(2)) ) );

            if( isempty(obj.payload) )
                Ann_struct2 = ECG_annotations;
            else
                Ann_struct = obj.payload;
                AnnNames = {};
                kk = 1;

                % Algorithm name
                for alg_name = rowvec(fieldnames(Ann_struct))

                    for lead_name = rowvec(fieldnames(Ann_struct.(alg_name{1})))

                        for wave_chosen = rowvec(obj.cAnnotationOutputFields)

                            wave_name = wave_chosen{1};

                            if( isfield(Ann_struct.(alg_name{1}).(lead_name{1}), wave_name ) )
                                aux_val = Ann_struct.(alg_name{1}).(lead_name{1});
                                if( isfield(aux_val, wave_name) )
                                    aux_val2 = ( aux_val.(wave_name) - aux_val.qrs ) * 1/ECG_header.freq;
                                    bAux = aux_val.qrs >= this_start_end(1) & aux_val.qrs <= this_start_end(2);
                                    lead_str = strrep(lead_name{1}, ' ', '_' );
                                    aux_str = [ wave_name '_' lead_str '_' alg_name{1}  ];
                                    Ann_struct2.(aux_str).time = [ (colvec(aux_val.qrs(bAux)) - ECG_start_offset + 1)  colvec(aux_val2(bAux))];
                                    AnnNames(kk,:) = { aux_str 'time' };
                                    kk = kk + 1;
                                end
                            end

                        end

                    end
                end

                % info about the series, requiered by the corrector
                % software.
                Ann_struct2.series_quality.AnnNames = AnnNames;
                Ann_struct2.series_quality.ratios = zeros(size(AnnNames,1),1);
                Ann_struct2.series_quality.estimated_labs = [];

            end

            if( ~isempty(ECG_start_offset) || ECG_start_offset > 1)
                 [~, iHours, iMins, iSeconds, iMilli ] = Seconds2HMS(ECG_start_offset/ECG_header.freq);
                 ECG_header.btime = datestr([2014,1,1,iHours, iMins,iSeconds], 'HH:MM:SS');
            end

            QRScorrector('ECG', ECG, 'QRS_annotations', Ann_struct2, 'Figure', figure(obj.fig_hdl) );

            disp_string_framed('*Blue', 'User interaction required' );

            aux_str = ['figure ' num2str(obj.fig_hdl) ''];

            aux_str2 = 'F5 (Run)';

            fprintf(1, 'This ECGtask allow user interaction. Press [CTRL + G] in %s to save results and press %s to continue.\n', aux_str, aux_str2)
            keyboard

            % last chance to save results
            if( ishandle(obj.fig_hdl) && (isempty(payload) || ~isstruct(payload)) )
                disp_string_framed('*[1,0.5,0]', 'Payload variable not saved' );
                fprintf(1, 'Press [CTRL + G] in %s to save results and press %s to continue.\n', aux_str, aux_str2)
                keyboard

                if( ~isempty(payload) && isstruct(payload) )
                    % save work done, to further improve in following
                    % invocations.
                    disp_string_framed('*Magenta', 'Corrections saved' );

                else
                    disp_string_framed('*[1,0.5,0]', 'Data not saved' );
                end

            else
                disp_string_framed('*Magenta', 'Corrections saved' );
            end

            if(ishandle(obj.fig_hdl))
                delete(obj.fig_hdl)
            end

            if(~(isempty(payload) || ~isstruct(payload)))
                % move QRS corrections according to the input offset
                for fn = rowvec(fieldnames(payload))
                    if( isfield(payload.(fn{1}), 'time' ) )
                        payload.(fn{1}).time = payload.(fn{1}).time + ECG_start_offset - 1;
                    end
                end
            end

            obj.progress_handle.show()

        end

        function payload = Finish(obj, payload, ECG_header)

        end

        function payload = Concatenate(obj, plA, plB)

            if( isempty(plA) )

                payload = plB;

            else

                fields = rowvec(unique( [rowvec(fieldnames(plA)) rowvec(fieldnames(plB))] ));

                diff_fields = setdiff(fields, {'series_quality'});

                for fn = diff_fields

                    if( isfield(plA, fn{1}) && isfield(plB, fn{1}) )
                        payload.(fn{1}).time = [ colvec(plA.(fn{1}).time); colvec(plB.(fn{1}).time) ];

                    elseif( ~isfield(plA, fn{1}) && isfield(plB, fn{1}) )
                        payload.(fn{1}).time = colvec(plB.(fn{1}).time);
                    end

                end

                aux_idx = find(strcmpi(fields, 'series_quality'));

                if( ~isempty(aux_idx) )

                    if( isfield(plA, 'series_quality') && isfield(plB, 'series_quality') )
                        payload.series_quality.ratios = [plA.series_quality.ratios plB.series_quality.ratios];
                        payload.series_quality.estimated_labs = cellfun(@(a,b)( [colvec(a);colvec(b)] ) , plA.series_quality.estimated_labs, plB.series_quality.estimated_labs, 'UniformOutput', false);
                        payload.series_quality.AnnNames = plA.series_quality.AnnNames;
                    end

                end

            end

        end

        %% property restriction functions

    end

    methods ( Access = private )

    end

end


function varargout = charGUI2(varargin)
% CHARGUI2 M-file for charGUI2.fig
%      CHARGUI2, by itself, creates a new CHARGUI2 or raises the existing
%      singleton*.
%
%      H = CHARGUI2 returns the handle to a new CHARGUI2 or the handle to
%      the existing singleton*.
%
%      CHARGUI2('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in CHARGUI2.M with the given input arguments.
%
%      CHARGUI2('Property','Value',...) creates a new CHARGUI2 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before charGUI_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to charGUI2_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help charGUI2

% Last Modified by GUIDE v2.5 03-Jul-2008 17:55:56

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @charGUI2_OpeningFcn, ...
                   'gui_OutputFcn',  @charGUI2_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before charGUI2 is made visible.
function charGUI2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to charGUI2 (see VARARGIN)
load data;
assignin('base','net',net);
% Choose default command line output for charGUI2
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes charGUI2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = charGUI2_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

% --- Executes on button press in pbLoad.
function pbLoad_Callback(hObject, eventdata, handles)
% hObject    handle to pbLoad (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[filename, pathname] = uigetfile({'*.bmp';'*.jpg';'*.gif';'*.*'}, 'Pick an Image File');
S = imread([pathname,filename]);
axes(handles.axes1);
imshow(S);

handles.S = S;
guidata(hObject, handles);

% --- Executes on button press in pbSelect.
function pbSelect_Callback(hObject, eventdata, handles)
% hObject    handle to pbSelect (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
S = handles.S;
axes(handles.axes1);

% Selection of location
if isfield(handles,'api')
    handles.api.delete();
    rmfield(handles,'api');
    rmfield(handles,'hRect');
    axes(handles.axes1);
    imshow(S);
end

axes(handles.axes1);
sz = size(S);
handles.hRect = imrect(gca,[round(sz(2)/2) round(sz(1)/2) 20 20]); % Select object
handles.api = iptgetapi(handles.hRect);
guidata(hObject, handles);

% img_crop = imcrop(S);
% axes(handles.axes2);
% imshow(img_crop);
%
% handles.img_crop = img_crop;

guidata(hObject, handles);

% --- Executes on button press in pbCrop.
function pbCrop_Callback(hObject, eventdata, handles)
% hObject    handle to pbCrop (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

handles.loc = handles.api.getPosition();
axes(handles.axes1);
S = handles.S;

handles.img_crop = imcrop(S,handles.loc);
axes(handles.axes2);
imshow(handles.img_crop);

% img_crop = imcrop(S);
% axes(handles.axes2);
% imshow(img_crop);
%
% handles.img_crop = img_crop;

guidata(hObject, handles);

% --- Executes on button press in pbPreprocess.
function pbPreprocess_Callback(hObject, eventdata, handles)
% hObject    handle to pbPreprocess (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

img_crop = handles.img_crop;
imgGray = rgb2gray(img_crop);
bw = im2bw(img_crop,graythresh(imgGray));
axes(handles.axes3);
imshow(bw);
bw2 = edu_imgcrop(bw);
axes(handles.axes4);
imshow(bw2);
handles.bw2 = bw2;
guidata(hObject, handles);

% --- Executes on button press in pbExtract.
function pbExtract_Callback(hObject, eventdata, handles)
% hObject    handle to pbExtract (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
bw2  = handles.bw2;
charvec = edu_imgresize(bw2);
axes(handles.axes5);
plotchar(charvec);
handles.charvec = charvec;
guidata(hObject, handles);

% --- Executes on button press in pbRecognize.
function pbRecognize_Callback(hObject, eventdata, handles)
% hObject    handle to pbRecognize (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
charvec = handles.charvec;
selected_net = get(handles.editNN,'string');

selected_net = evalin('base',selected_net);

result = sim(selected_net,charvec);
[val, num] = max(result);
set(handles.editResult, 'string',num);

% --- Executes on button press in pbNN.
function pbNN_Callback(hObject, eventdata, handles)
% hObject    handle to pbNN (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

function editNN_Callback(hObject, eventdata, handles)
% hObject    handle to editNN (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editNN as text
%        str2double(get(hObject,'String')) returns contents of editNN as a double

% --- Executes during object creation, after setting all properties.
function editNN_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editNN (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function editResult_Callback(hObject, eventdata, handles)
% hObject    handle to editResult (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of editResult as text
%        str2double(get(hObject,'String')) returns contents of editResult as a double

% --- Executes during object creation, after setting all properties.
function editResult_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editResult (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function msk=get_lines_executable(obj)
% get a mask indicating which lines are executable
%
% msk=get_lines_executable(obj)
%
% Input:
%   obj                 MOcovMFile instance
%
% Output:
%   msk                 Nx1 logical mask, with msk(k)==true indicating
%                       that the k-th line can be exectued

    msk=obj.executable;


function data = h5loadgroup(loc)

data = struct();

num_objs = H5G.get_num_objs(loc);

%
% Load groups and datasets
%
for j_item = 0:num_objs-1
    objtype = H5G.get_objtype_by_idx(loc, j_item);
    objname = H5G.get_objname_by_idx(loc, j_item);

    if objtype == 0
        % Group
        name = regexprep(objname, '.*/', '');

        if ~isempty(regexp(name,'^[a-zA-Z].*'))
            group_loc = H5G.open(loc, name);
            try
                sub_data = h5loadgroup(group_loc);
                H5G.close(group_loc);
            catch exc
                H5G.close(group_loc);
                rethrow(exc);
            end
            if isempty(path_parts)
                data = setfield(data, name, sub_data);
            else
                data = sub_data;
                return
            end
        end

    elseif objtype == 1
        % Dataset
        name = regexprep(objname, '.*/', '');
        if ~isempty(regexp(name,'^[a-zA-Z].*'))
            dataset_loc = H5D.open(loc, name);
            try
                % NOTE: HDF5 stores contiguous muti-dimensional arrays in row-major order.
                % Matlab stores them in row-major order. We want to transpose the loaded data
                % it back to Matlab's column-major storage order and thus get back the
                % original array.
                sub_data = H5D.read(dataset_loc, 'H5ML_DEFAULT', 'H5S_ALL','H5S_ALL','H5P_DEFAULT');
                sub_data = HDF5_PostProcessing(sub_data);

                H5D.close(dataset_loc);
            catch exc
                H5D.close(dataset_loc);
                rethrow(exc);
            end

            sub_data = fix_data(sub_data);

            data = setfield(data, name, sub_data);
        end
    end

end

% ---------------------------------------------------------------------
function data = fix_data(data)
% Fix some common types of data to more friendly form.

if isstruct(data)
    fields = fieldnames(data);
    if length(fields) == 2 & strcmp(fields{1}, 'r') & strcmp(fields{2}, 'i')
        if isnumeric(data.r) & isnumeric(data.i)
            data = data.r + 1j*data.i;
        end
    end
end

if isnumeric(data) & ndims(data) > 1
    % permute dimensions
    data = permute(data, fliplr(1:ndims(data)));
end


%Full Length simulation test
%
% Author: Jonathan Karr, jkarr@stanford.edu
% Affiliation: Covert Lab, Department of Bioengineering, Stanford University
% Last updated: 1/12/2011
classdef Simulation_FullLength_Test < TestCase
    methods
        function this = Simulation_FullLength_Test(name)
            this = this@TestCase(name);
        end
    end

    methods
        function testSimulation(~)
            runSimulation('outDir', 'output/runSimulationTests', 'logToDisk', true, 'logToDb', false);
        end
    end
end


function varargout = flipud(varargin) %#ok<STOUT>
%FLIPUD   Flip/reverse an UNBNDFUN object.
%   FLIPUD is not support for FUN objects on unbounded domains.

% Copyright 2017 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.

error('CHEBFUN:UNBNDFUN:flipud:noSupport', ...
    'FLIPUD does not support UNBNDFUN objects.');

end


function events = NewEvents(times,description)

%NewEvents - Create events structure.
%
%  USAGE
%
%    events = NewEvents(times,description)
%
%    times               event timestamps
%    description         (common) event description

% Copyright (C) 2008-2011 by Michaël Zugaro
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 3 of the License, or
% (at your option) any later version.

events.time = times;
events.description = cell(size(times));
[events.description{:}] = deal(description);


 function ob = ctranspose(ob)
%function ob = ctranspose(ob)
%	"ctranspose" method for Gtomo2 class

%	transpose base object
base = ob.base;
ob.base = base';


function got_displayed = warn_once(varargin)
% Emit a specific warning only once (per MATLAB session).
% GotDiplayed = warn_once(MessageId,Message,Arguments...)
%
% This function behaves like the built-in warning, except that a message with the given content is
% only emitted once per MATLAB session. The warnings can be reset with the command: clear warn_once
%
% In:
%   MessageId: optional message ID (see built-in warning)
%
%   Message : the message content, as in sprintf
%             special case: if this is 'clear', the memory of displayed warnings will be discarded
%
%   Arguments... : list of arguments that may be substituted into Message (like in sprintf)
%
% Out:
%   GotDisplayed : whether the message got displayed
%
% Examples:
%   % display a warning, but just once
%   warn_once('Error opening file %s',filename);
%
% See also:
%   warning
%
%                                Christian Kothe, Swartz Center for Computational Neuroscience, UCSD
%                                2011-02-13

% Copyright (C) Christian Kothe, SCCN, 2011, christian@sccn.ucsd.edu
%
% This program is free software; you can redistribute it and/or modify it under the terms of the GNU
% General Public License as published by the Free Software Foundation; either version 2 of the
% License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
% even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License along with this program; if not,
% write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
% USA

persistent displayed_warnings;

if strcmp(varargin{1},'clear')
    % clear the stored messages
    displayed_warnings = [];
    return;
end

% determine the message content
if length(varargin) > 1 && any(varargin{1}==':') && ~any(varargin{1}==' ') && ischar(varargin{2})
    message_content = [varargin{1} sprintf(varargin{2:end})];
else
    message_content = sprintf(varargin{1:end});
end

% generate a hash of it
str = java.lang.String(message_content);
message_id = sprintf('x%.0f',str.hashCode()+2^31);

% and check if it had been displayed before
if ~isfield(displayed_warnings,message_id)
    % emit the warning
    warning(varargin{:});
    got_displayed = true;
    % remember to not display the warning again
    displayed_warnings.(message_id) = true;
else
    got_displayed = false;
end


% save_intermediate - example hook function for each epoch
% Copyright (C) 2011 KyungHyun Cho, Tapani Raiko, Alexander Ilin
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
%

function err = save_intermediate (R, args)

% args is a cell array
savefile = args{1};

save(savefile, 'R');

% -1 signals the end of training
err = 0;


function display_legend(plot_obj)
% Displays the legend on the plot.  Call this function only once
% all curves have been plotted.

if length(plot_obj.legend_strings) > 0
    figure(plot_obj.fh)
    legend(plot_obj.handles_vec,plot_obj.legend_strings)
end
end


function [modelIDsMissingInTable,incorrectIDsInTable] = testInputFiles
% Tests if the names of all reconstructed microbes are present in the input
% files for the AGORA2 pipeline.
%
% OUTPUT
% modelIDsMissingInTable       AGORA2 reconstruction IDs missing in the table
% incorrectIDsInTable          Reconstruction IDs in the table not
%                              corresponding to any reconstruction
% Almut Heinken, 09/2019

[~, infoFile, ~] = xlsread('AGORA2_infoFile.xlsx');
models=infoFile(2:end,1);

inputTables = {
    'AromaticAATable'
    'BileAcidTable'
    'CarbonSourcesTable'
    'FermentationTable'
    'GenomeAnnotation'
    'GrowthRequirementsTable'
    'PutrefactionTable'
    'uptakeTable'
    'secretionProductTable'
    };

for i = 1:length(inputTables)
    table = readtable([inputTables{i} '.txt'], 'ReadVariableNames', false, 'Delimiter', 'tab','TreatAsEmpty',['UND. -60001','UND. -2011','UND. -62011']);
    table = table2cell(table);
    notintable = setdiff(models,table(2:end,1));
    modelIDsMissingInTable.(inputTables{i})= notintable;
    incorrectIDs=setdiff(table(2:end,1),models);
    incorrectIDsInTable.(inputTables{i})= incorrectIDs;
    if ~isempty(notintable)
        warning(['Some reconstruction names are not present in table ' inputTables{i}])
    end
    if ~isempty(incorrectIDs)
        warning(['Some reconstruction IDs are incorrect in table ' inputTables{i}])
    end
end

end


function T = real(T)

T.M = real(T.M);


% compare EEGLAB distributions

% Copyright (C) 2006 Arnaud Delorme
%
% This file is part of EEGLAB, see http://www.eeglab.org
% for the documentation and details.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are met:
%
% 1. Redistributions of source code must retain the above copyright notice,
% this list of conditions and the following disclaimer.
%
% 2. Redistributions in binary form must reproduce the above copyright notice,
% this list of conditions and the following disclaimer in the documentation
% and/or other materials provided with the distribution.
%
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
% THE POSSIBILITY OF SUCH DAMAGE.

function compareeeglabdistrib(folder1, folder2)

fileList1 = getmfilelist(folder1);
fileList2 = getmfilelist(folder2);

% strip list from folders
for iFile = 1:length(fileList1), fileList1{iFile} = fileList1{iFile}(length(folder1)+1:end); end
for iFile = 1:length(fileList2), fileList2{iFile} = fileList2{iFile}(length(folder2)+1:end); end

for iFile1 = 1:length(fileList1)
    iFile2 = strmatch(fileList1{iFile1}, fileList2, 'exact');
    if isempty(iFile2)
        fprintf('Missing file %s in folder %s\n', fileList1{iFile1}, folder2);
    else
        dir1 = dir(fullfile(folder1, fileList1{iFile1}));
        dir2 = dir(fullfile(folder2, fileList2{iFile2}));
        if length(dir1) ~= 1 || length(dir2) ~= 1
            error('Size error');
        end
        if dir1.bytes ~= dir2.bytes
            fprintf('Files %s differ\n', fileList2{iFile2});
            %fprintf('---------------------\n');
            %system([ '/usr/bin/diff ' fullfile(folder1, fileList1{iFile1}) ' ' fullfile(folder2, fileList2{iFile2}) ]);
        end
        fileList2(iFile2) = [];
    end
end

for iFile2 = 1:length(fileList2)
    fprintf('Missing file %s in folder %s\n', fileList2{iFile2}, folder1);
end


function s = saveobj(obj)
%SAVEOBJ  Save a DagNN to a vanilla MATLAB structure
%   S = OBJ.SAVEOBJ() saves the DagNN OBJ to a vanilla MATLAB
%   structure S. This is particularly convenient to preserve future
%   compatibility and to ship networks that are pure structures,
%   instead of embedding dependencies to code.
%
%   The object can be reconstructe by `obj = DagNN.loadobj(s)`.

% Copyright (C) 2015 Karel Lenc and Andrea Vedaldi.
% All rights reserved.
%
% This file is part of the VLFeat library and is made available under
% the terms of the BSD license (see the COPYING file).

device = obj.device ;
obj.move('cpu') ;
s.vars = struct(...
  'name', {obj.vars.name}, ...
  'precious', {obj.vars.precious}) ;
s.params = struct(...
  'name', {obj.params.name}, ...
  'value', {obj.params.value}, ...
  'learningRate', {obj.params.learningRate}, ...
  'weightDecay', {obj.params.weightDecay}) ;
s.layers = struct(...
  'name', {obj.layers.name}, ...
  'type', {[]}, ...
  'inputs', {obj.layers.inputs}, ...
  'outputs', {obj.layers.outputs}, ...
  'params', {obj.layers.params}, ...
  'block', {[]}) ;
s.meta = obj.meta ;

for l = 1:numel(obj.layers)
  block = obj.layers(l).block ;
  slayer = block.save() ;
  s.layers(l).type = class(block) ;
  s.layers(l).block = slayer ;
end