<commit_before>//
// RemotePhotoTool - remote camera control software
// Copyright (C) 2008-2014 Michael Fink
//
/// \file EdsdkPropertyAccess.hpp EDSDK - Property access
//
#pragma once

// includes
#include "EdsdkCommon.hpp"
#include "Variant.hpp"
#include "ImageProperty.hpp"
#include <boost/noncopyable.hpp>

namespace EDSDK
{

/// unknown property (available on EOS 40D)
#define kEdsPropID_Unknown1   0x00000065
/// shutter counter property; can't be read out with newest SDK anymore
#define kEdsPropID_ShutterCounter 0x00000022

/// combined image or device property access
class PropertyAccess : public boost::noncopyable
{
public:
   /// ctor
   PropertyAccess(const Handle& h) throw()
      :m_h(h)
   {
   }

   /// gets property value
   Variant Get(EdsPropertyID propId, int iParam = 0) const
   {
      // first, get type and size of property
      EdsDataType dataType = kEdsDataType_Unknown;
      EdsUInt32 size = 0;
      GetTypeAndSize(propId, iParam, dataType, size);

      // now get the data bytes
      std::vector<BYTE> vecData(size);
      EdsError err = EdsGetPropertyData(m_h, propId, iParam, size, &vecData[0]);
      //LOG_TRACE(_T("EdsGetPropertyData(ref = %08x, id = %04x, param = %u, size = %u, &data) returned %08x\n"),
      //   m_h.Get(), propId, iParam, size, err);
      EDSDK::CheckError(_T("EdsGetPropertyData"), err, __FILE__, __LINE__);

      // convert to variant
      Variant v;
      SetRawEdsdk(v, dataType, vecData);
      return v;
   }

   /// sets new property value
   void Set(EdsPropertyID propId, Variant value, int iParam = 0)
   {
      // first, get type and size of property
      EdsDataType dataType = kEdsDataType_Unknown;
      EdsUInt32 size = 0;
      GetTypeAndSize(propId, iParam, dataType, size);

      // then generate data bytes from variant
      std::vector<BYTE> vecData;
      GetRawEdsdk(value, dataType, vecData);

      LOG_TRACE(_T("Property [%s] set to value [%s]\n"),
         PropertyAccess::NameFromId(propId),
         PropertyAccess::DisplayTextFromIdAndValue(propId, value));

      // now set the property
      EdsError err = EdsSetPropertyData(m_h, propId, iParam, size, &vecData[0]);
      if (err != EDS_ERR_OK) // only log errors here
         LOG_TRACE(_T("EdsSetPropertyData(ref = %08x, id = %04x, param = %u, size = %u, &data) returned %08x\n"),
            m_h.Get(), propId, iParam, size, err);
      EDSDK::CheckError(_T("EdsSetPropertyData"), err, __FILE__, __LINE__);
   }

   /// enumerates possible property values
   void Enum(EdsPropertyID propId, std::vector<Variant>& vecValues, bool& bReadOnly)
   {
      // note: since all properties that can be retrieved are of type UInt8, assume that
      EdsPropertyDesc propDesc = {0};
      EdsError err = EdsGetPropertyDesc(m_h, propId, &propDesc);
      //LOG_TRACE(_T("EdsGetPropertyDesc(ref = %08x, id = %04x, &numProp = %u) returned %08x\n"),
      //   m_h.Get(), propId, propDesc.numElements, err);
      EDSDK::CheckError(_T("EdsGetPropertyDesc"), err, __FILE__, __LINE__);

      // note: this reinterpret cast assumes that EdsInt32 and EdsUInt32 have the same size
      static_assert(sizeof(propDesc.propDesc[0]) == sizeof(EdsUInt32), "propDesc must have type and size EdsUInt32");

      if (propDesc.access == 0)
         bReadOnly = true;

      if (propDesc.numElements > 0)
      {
         unsigned int* puiData = reinterpret_cast<unsigned int*>(propDesc.propDesc);
         for (EdsInt32 i=0; i<propDesc.numElements; i++)
         {
            Variant v;
            v.Set(puiData[i]);
            v.SetType(Variant::typeUInt32);
            vecValues.push_back(v);
         }
      }
   }

   /// returns if property currently is read only
   bool IsReadOnly(EdsPropertyID propId) const
   {
      EdsPropertyDesc propDesc = {0};
      EdsError err = EdsGetPropertyDesc(m_h, propId, &propDesc);
      //LOG_TRACE(_T("EdsGetPropertyDesc(ref = %08x, id = %04x, &numProp = %u) returned %08x\n"),
      //   m_h.Get(), propId, propDesc.numElements, err);
      EDSDK::CheckError(_T("EdsGetPropertyDesc"), err, __FILE__, __LINE__);

      // note: this reinterpret cast assumes that EdsInt32 and EdsUInt32 have the same size
      static_assert(sizeof(propDesc.propDesc[0]) == sizeof(EdsUInt32), "propDesc must have type and size EdsUInt32");

      return (propDesc.access == 0);
   }

   /// returns type and size of given property
   void GetTypeAndSize(EdsPropertyID propId, int iParam, EdsDataType& dataType, EdsUInt32& size) const
   {
      dataType = kEdsDataType_Unknown;
      size = 0;

      EdsError err = EdsGetPropertySize(m_h, propId, iParam, &dataType, &size);
      //LOG_TRACE(_T("EdsGetPropertySize(ref = %08x, id = %04x, param = %u, &type = %u, &size = %u) returned %08x\n"),
      //   m_h.Get(), propId, iParam, dataType, size, err);
      EDSDK::CheckError(_T("EdsGetPropertySize"), err, __FILE__, __LINE__);

      // it seems white balance returns the wrong data type (Int32) here; fix this
      if (propId == kEdsPropID_WhiteBalance)
         dataType = kEdsDataType_UInt32;
   }

   /// returns if property is available
   bool IsPropertyAvail(unsigned int uiPropId) const throw()
   {
      // check if property exists by retrieving type and size
      EdsDataType dataType = kEdsDataType_Unknown;
      EdsUInt32 size = 0;
      EdsError err = EdsGetPropertySize(m_h.Get(), uiPropId, 0, &dataType, &size);
      return (err == EDS_ERR_OK && dataType != kEdsDataType_Unknown);
   }

   /// enumerates device ids
   void EnumDeviceIds(std::vector<unsigned int>& vecDeviceIds);

   /// enumerates image ids
   void EnumImageIds(std::vector<unsigned int>& vecImageIds);

   /// sets raw bytes to given variant
   static void SetRawEdsdk(Variant& v, unsigned int datatype, std::vector<unsigned char> vecData);

   /// gets raw bytes from variant
   static void GetRawEdsdk(const Variant& v, unsigned int datatype, std::vector<unsigned char>& vecData);

   /// formats image format value
   static CString FormatImageFormatValue(unsigned int uiValue);

   /// maps property type to property id
   static EdsPropertyID MapToPropertyID(T_enImagePropertyType enProperty) throw()
   {
      switch(enProperty)
      {
      case propShootingMode:        return kEdsPropID_AEMode;//kEdsPropID_AEModeSelect;
      case propDriveMode:     return kEdsPropID_DriveMode;
      case propISOSpeed:      return kEdsPropID_ISOSpeed;
      case propMeteringMode:  return kEdsPropID_MeteringMode;
      case propAFMode:        return kEdsPropID_AFMode;
      case propAv:            return kEdsPropID_Av;
      case propTv:            return kEdsPropID_Tv;
      case propExposureCompensation:   return kEdsPropID_ExposureCompensation;
      case propFlashExposureComp:      return kEdsPropID_FlashCompensation;
      case propFocalLength:            return kEdsPropID_FocalLength;
      case propFlashMode:              return kEdsPropID_FlashMode;
      case propWhiteBalance:           return kEdsPropID_WhiteBalance;
      case propAFDistance:             return kEdsPropID_Unknown;
      case propCurrentZoomPos:         return kEdsPropID_Unknown;
      case propMaxZoomPos:             return kEdsPropID_Unknown;
      case propAvailableShots:         return kEdsPropID_AvailableShots;
      case propSaveTo:                 return kEdsPropID_SaveTo;
      case propBatteryLevel:           return kEdsPropID_BatteryQuality;
      default:
         ATLASSERT(false);
         return kEdsPropID_Unknown;
      }
   }

   /// returns name from property id
   static LPCTSTR NameFromId(EdsPropertyID propertyId) throw();

   /// formats display text from id and value
   static CString DisplayTextFromIdAndValue(EdsPropertyID /*propertyId*/, Variant value);

private:
   /// handle to object
   const Handle& m_h;
};

} // namespace EDSDK
<commit_msg>added propImageFormat to property mapping for ED-SDK<commit_after>//
// RemotePhotoTool - remote camera control software
// Copyright (C) 2008-2014 Michael Fink
//
/// \file EdsdkPropertyAccess.hpp EDSDK - Property access
//
#pragma once

// includes
#include "EdsdkCommon.hpp"
#include "Variant.hpp"
#include "ImageProperty.hpp"
#include <boost/noncopyable.hpp>

namespace EDSDK
{

/// unknown property (available on EOS 40D)
#define kEdsPropID_Unknown1   0x00000065
/// shutter counter property; can't be read out with newest SDK anymore
#define kEdsPropID_ShutterCounter 0x00000022

/// combined image or device property access
class PropertyAccess : public boost::noncopyable
{
public:
   /// ctor
   PropertyAccess(const Handle& h) throw()
      :m_h(h)
   {
   }

   /// gets property value
   Variant Get(EdsPropertyID propId, int iParam = 0) const
   {
      // first, get type and size of property
      EdsDataType dataType = kEdsDataType_Unknown;
      EdsUInt32 size = 0;
      GetTypeAndSize(propId, iParam, dataType, size);

      // now get the data bytes
      std::vector<BYTE> vecData(size);
      EdsError err = EdsGetPropertyData(m_h, propId, iParam, size, &vecData[0]);
      //LOG_TRACE(_T("EdsGetPropertyData(ref = %08x, id = %04x, param = %u, size = %u, &data) returned %08x\n"),
      //   m_h.Get(), propId, iParam, size, err);
      EDSDK::CheckError(_T("EdsGetPropertyData"), err, __FILE__, __LINE__);

      // convert to variant
      Variant v;
      SetRawEdsdk(v, dataType, vecData);
      return v;
   }

   /// sets new property value
   void Set(EdsPropertyID propId, Variant value, int iParam = 0)
   {
      // first, get type and size of property
      EdsDataType dataType = kEdsDataType_Unknown;
      EdsUInt32 size = 0;
      GetTypeAndSize(propId, iParam, dataType, size);

      // then generate data bytes from variant
      std::vector<BYTE> vecData;
      GetRawEdsdk(value, dataType, vecData);

      LOG_TRACE(_T("Property [%s] set to value [%s]\n"),
         PropertyAccess::NameFromId(propId),
         PropertyAccess::DisplayTextFromIdAndValue(propId, value));

      // now set the property
      EdsError err = EdsSetPropertyData(m_h, propId, iParam, size, &vecData[0]);
      if (err != EDS_ERR_OK) // only log errors here
         LOG_TRACE(_T("EdsSetPropertyData(ref = %08x, id = %04x, param = %u, size = %u, &data) returned %08x\n"),
            m_h.Get(), propId, iParam, size, err);
      EDSDK::CheckError(_T("EdsSetPropertyData"), err, __FILE__, __LINE__);
   }

   /// enumerates possible property values
   void Enum(EdsPropertyID propId, std::vector<Variant>& vecValues, bool& bReadOnly)
   {
      // note: since all properties that can be retrieved are of type UInt8, assume that
      EdsPropertyDesc propDesc = {0};
      EdsError err = EdsGetPropertyDesc(m_h, propId, &propDesc);
      //LOG_TRACE(_T("EdsGetPropertyDesc(ref = %08x, id = %04x, &numProp = %u) returned %08x\n"),
      //   m_h.Get(), propId, propDesc.numElements, err);
      EDSDK::CheckError(_T("EdsGetPropertyDesc"), err, __FILE__, __LINE__);

      // note: this reinterpret cast assumes that EdsInt32 and EdsUInt32 have the same size
      static_assert(sizeof(propDesc.propDesc[0]) == sizeof(EdsUInt32), "propDesc must have type and size EdsUInt32");

      if (propDesc.access == 0)
         bReadOnly = true;

      if (propDesc.numElements > 0)
      {
         unsigned int* puiData = reinterpret_cast<unsigned int*>(propDesc.propDesc);
         for (EdsInt32 i=0; i<propDesc.numElements; i++)
         {
            Variant v;
            v.Set(puiData[i]);
            v.SetType(Variant::typeUInt32);
            vecValues.push_back(v);
         }
      }
   }

   /// returns if property currently is read only
   bool IsReadOnly(EdsPropertyID propId) const
   {
      EdsPropertyDesc propDesc = {0};
      EdsError err = EdsGetPropertyDesc(m_h, propId, &propDesc);
      //LOG_TRACE(_T("EdsGetPropertyDesc(ref = %08x, id = %04x, &numProp = %u) returned %08x\n"),
      //   m_h.Get(), propId, propDesc.numElements, err);
      EDSDK::CheckError(_T("EdsGetPropertyDesc"), err, __FILE__, __LINE__);

      // note: this reinterpret cast assumes that EdsInt32 and EdsUInt32 have the same size
      static_assert(sizeof(propDesc.propDesc[0]) == sizeof(EdsUInt32), "propDesc must have type and size EdsUInt32");

      return (propDesc.access == 0);
   }

   /// returns type and size of given property
   void GetTypeAndSize(EdsPropertyID propId, int iParam, EdsDataType& dataType, EdsUInt32& size) const
   {
      dataType = kEdsDataType_Unknown;
      size = 0;

      EdsError err = EdsGetPropertySize(m_h, propId, iParam, &dataType, &size);
      //LOG_TRACE(_T("EdsGetPropertySize(ref = %08x, id = %04x, param = %u, &type = %u, &size = %u) returned %08x\n"),
      //   m_h.Get(), propId, iParam, dataType, size, err);
      EDSDK::CheckError(_T("EdsGetPropertySize"), err, __FILE__, __LINE__);

      // it seems white balance returns the wrong data type (Int32) here; fix this
      if (propId == kEdsPropID_WhiteBalance)
         dataType = kEdsDataType_UInt32;
   }

   /// returns if property is available
   bool IsPropertyAvail(unsigned int uiPropId) const throw()
   {
      // check if property exists by retrieving type and size
      EdsDataType dataType = kEdsDataType_Unknown;
      EdsUInt32 size = 0;
      EdsError err = EdsGetPropertySize(m_h.Get(), uiPropId, 0, &dataType, &size);
      return (err == EDS_ERR_OK && dataType != kEdsDataType_Unknown);
   }

   /// enumerates device ids
   void EnumDeviceIds(std::vector<unsigned int>& vecDeviceIds);

   /// enumerates image ids
   void EnumImageIds(std::vector<unsigned int>& vecImageIds);

   /// sets raw bytes to given variant
   static void SetRawEdsdk(Variant& v, unsigned int datatype, std::vector<unsigned char> vecData);

   /// gets raw bytes from variant
   static void GetRawEdsdk(const Variant& v, unsigned int datatype, std::vector<unsigned char>& vecData);

   /// formats image format value
   static CString FormatImageFormatValue(unsigned int uiValue);

   /// maps property type to property id
   static EdsPropertyID MapToPropertyID(T_enImagePropertyType enProperty) throw()
   {
      switch(enProperty)
      {
      case propShootingMode:        return kEdsPropID_AEMode;//kEdsPropID_AEModeSelect;
      case propDriveMode:     return kEdsPropID_DriveMode;
      case propISOSpeed:      return kEdsPropID_ISOSpeed;
      case propMeteringMode:  return kEdsPropID_MeteringMode;
      case propAFMode:        return kEdsPropID_AFMode;
      case propAv:            return kEdsPropID_Av;
      case propTv:            return kEdsPropID_Tv;
      case propExposureCompensation:   return kEdsPropID_ExposureCompensation;
      case propFlashExposureComp:      return kEdsPropID_FlashCompensation;
      case propFocalLength:            return kEdsPropID_FocalLength;
      case propFlashMode:              return kEdsPropID_FlashMode;
      case propWhiteBalance:           return kEdsPropID_WhiteBalance;
      case propAFDistance:             return kEdsPropID_Unknown;
      case propCurrentZoomPos:         return kEdsPropID_Unknown;
      case propMaxZoomPos:             return kEdsPropID_Unknown;
      case propAvailableShots:         return kEdsPropID_AvailableShots;
      case propSaveTo:                 return kEdsPropID_SaveTo;
      case propBatteryLevel:           return kEdsPropID_BatteryQuality;
      case propImageFormat:            return kEdsPropID_ImageQuality;
      default:
         ATLASSERT(false);
         return kEdsPropID_Unknown;
      }
   }

   /// returns name from property id
   static LPCTSTR NameFromId(EdsPropertyID propertyId) throw();

   /// formats display text from id and value
   static CString DisplayTextFromIdAndValue(EdsPropertyID /*propertyId*/, Variant value);

private:
   /// handle to object
   const Handle& m_h;
};

} // namespace EDSDK
<|endoftext|>


<commit_before>/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "SkCodec.h"
#include "SkCodecPriv.h"
#include "SkMath.h"
#include "SkSampledCodec.h"

SkSampledCodec::SkSampledCodec(SkCodec* codec)
    : INHERITED(codec->getInfo())
    , fCodec(codec)
{}

SkISize SkSampledCodec::accountForNativeScaling(int* sampleSizePtr, int* nativeSampleSize) const {
    SkISize preSampledSize = fCodec->getInfo().dimensions();
    int sampleSize = *sampleSizePtr;
    SkASSERT(sampleSize > 1);

    if (nativeSampleSize) {
        *nativeSampleSize = 1;
    }

    // Only JPEG supports native downsampling.
    if (fCodec->getEncodedFormat() == kJPEG_SkEncodedFormat) {
        // See if libjpeg supports this scale directly
        switch (sampleSize) {
            case 2:
            case 4:
            case 8:
                // This class does not need to do any sampling.
                *sampleSizePtr = 1;
                return fCodec->getScaledDimensions(get_scale_from_sample_size(sampleSize));
            default:
                break;
        }

        // Check if sampleSize is a multiple of something libjpeg can support.
        int remainder;
        const int sampleSizes[] = { 8, 4, 2 };
        for (int supportedSampleSize : sampleSizes) {
            int actualSampleSize;
            SkTDivMod(sampleSize, supportedSampleSize, &actualSampleSize, &remainder);
            if (0 == remainder) {
                float scale = get_scale_from_sample_size(supportedSampleSize);

                // fCodec will scale to this size.
                preSampledSize = fCodec->getScaledDimensions(scale);

                // And then this class will sample it.
                *sampleSizePtr = actualSampleSize;
                if (nativeSampleSize) {
                    *nativeSampleSize = supportedSampleSize;
                }
                break;
            }
        }
    }

    return preSampledSize;
}

SkISize SkSampledCodec::onGetSampledDimensions(int sampleSize) const {
    const SkISize size = this->accountForNativeScaling(&sampleSize);
    return SkISize::Make(get_scaled_dimension(size.width(), sampleSize),
                         get_scaled_dimension(size.height(), sampleSize));
}

SkCodec::Result SkSampledCodec::onGetAndroidPixels(const SkImageInfo& info, void* pixels,
        size_t rowBytes, const AndroidOptions& options) {
    // Create an Options struct for the codec.
    SkCodec::Options codecOptions;
    codecOptions.fZeroInitialized = options.fZeroInitialized;

    SkIRect* subset = options.fSubset;
    if (!subset || subset->size() == fCodec->getInfo().dimensions()) {
        if (fCodec->dimensionsSupported(info.dimensions())) {
            return fCodec->getPixels(info, pixels, rowBytes, &codecOptions, options.fColorPtr,
                    options.fColorCount);
        }

        // If the native codec does not support the requested scale, scale by sampling.
        return this->sampledDecode(info, pixels, rowBytes, options);
    }

    // We are performing a subset decode.
    int sampleSize = options.fSampleSize;
    SkISize scaledSize = this->getSampledDimensions(sampleSize);
    if (!fCodec->dimensionsSupported(scaledSize)) {
        // If the native codec does not support the requested scale, scale by sampling.
        return this->sampledDecode(info, pixels, rowBytes, options);
    }

    // Calculate the scaled subset bounds.
    int scaledSubsetX = subset->x() / sampleSize;
    int scaledSubsetY = subset->y() / sampleSize;
    int scaledSubsetWidth = info.width();
    int scaledSubsetHeight = info.height();

    // Start the scanline decode.
    SkIRect scanlineSubset = SkIRect::MakeXYWH(scaledSubsetX, 0, scaledSubsetWidth,
            scaledSize.height());
    codecOptions.fSubset = &scanlineSubset;
    SkCodec::Result result = fCodec->startScanlineDecode(info.makeWH(scaledSize.width(),
            scaledSize.height()), &codecOptions, options.fColorPtr, options.fColorCount);
    if (SkCodec::kSuccess != result) {
        return result;
    }

    // At this point, we are only concerned with subsetting.  Either no scale was
    // requested, or the fCodec is handling the scale.
    switch (fCodec->getScanlineOrder()) {
        case SkCodec::kTopDown_SkScanlineOrder:
        case SkCodec::kNone_SkScanlineOrder: {
            if (!fCodec->skipScanlines(scaledSubsetY)) {
                fCodec->fillIncompleteImage(info, pixels, rowBytes, options.fZeroInitialized,
                        scaledSubsetHeight, 0);
                return SkCodec::kIncompleteInput;
            }

            int decodedLines = fCodec->getScanlines(pixels, scaledSubsetHeight, rowBytes);
            if (decodedLines != scaledSubsetHeight) {
                return SkCodec::kIncompleteInput;
            }
            return SkCodec::kSuccess;
        }
        default:
            SkASSERT(false);
            return SkCodec::kUnimplemented;
    }
}

SkCodec::Result SkSampledCodec::sampledDecode(const SkImageInfo& info, void* pixels,
        size_t rowBytes, const AndroidOptions& options) {
    // We should only call this function when sampling.
    SkASSERT(options.fSampleSize > 1);

    // Create options struct for the codec.
    SkCodec::Options sampledOptions;
    sampledOptions.fZeroInitialized = options.fZeroInitialized;

    // FIXME: This was already called by onGetAndroidPixels. Can we reduce that?
    int sampleSize = options.fSampleSize;
    int nativeSampleSize;
    SkISize nativeSize = this->accountForNativeScaling(&sampleSize, &nativeSampleSize);

    // Check if there is a subset.
    SkIRect subset;
    int subsetY = 0;
    int subsetWidth = nativeSize.width();
    int subsetHeight = nativeSize.height();
    if (options.fSubset) {
        // We will need to know about subsetting in the y-dimension in order to use the
        // scanline decoder.
        // Update the subset to account for scaling done by fCodec.
        SkIRect* subsetPtr = options.fSubset;

        // Do the divide ourselves, instead of calling get_scaled_dimension. If
        // X and Y are 0, they should remain 0, rather than being upgraded to 1
        // due to being smaller than the sampleSize.
        const int subsetX = subsetPtr->x() / nativeSampleSize;
        subsetY = subsetPtr->y() / nativeSampleSize;

        subsetWidth = get_scaled_dimension(subsetPtr->width(), nativeSampleSize);
        subsetHeight = get_scaled_dimension(subsetPtr->height(), nativeSampleSize);

        // The scanline decoder only needs to be aware of subsetting in the x-dimension.
        subset.setXYWH(subsetX, 0, subsetWidth, nativeSize.height());
        sampledOptions.fSubset = ⊂
    }

    // Start the scanline decode.
    SkCodec::Result result = fCodec->startScanlineDecode(
            info.makeWH(nativeSize.width(), nativeSize.height()), &sampledOptions,
            options.fColorPtr, options.fColorCount);
    if (SkCodec::kSuccess != result) {
        return result;
    }

    SkSampler* sampler = fCodec->getSampler(true);
    if (!sampler) {
        return SkCodec::kUnimplemented;
    }

    // Since we guarantee that output dimensions are always at least one (even if the sampleSize
    // is greater than a given dimension), the input sampleSize is not always the sampleSize that
    // we use in practice.
    const int sampleX = subsetWidth / info.width();
    const int sampleY = subsetHeight / info.height();
    if (sampler->setSampleX(sampleX) != info.width()) {
        return SkCodec::kInvalidScale;
    }
    if (get_scaled_dimension(subsetHeight, sampleY) != info.height()) {
        return SkCodec::kInvalidScale;
    }

    const int samplingOffsetY = get_start_coord(sampleY);
    const int startY = samplingOffsetY + subsetY;
    int dstHeight = info.height();
    switch(fCodec->getScanlineOrder()) {
        case SkCodec::kTopDown_SkScanlineOrder: {
            if (!fCodec->skipScanlines(startY)) {
                fCodec->fillIncompleteImage(info, pixels, rowBytes, options.fZeroInitialized,
                        dstHeight, 0);
                return SkCodec::kIncompleteInput;
            }
            void* pixelPtr = pixels;
            for (int y = 0; y < dstHeight; y++) {
                if (1 != fCodec->getScanlines(pixelPtr, 1, rowBytes)) {
                    fCodec->fillIncompleteImage(info, pixels, rowBytes, options.fZeroInitialized,
                            dstHeight, y + 1);
                    return SkCodec::kIncompleteInput;
                }
                int linesToSkip = SkTMin(sampleY - 1, dstHeight - y - 1);
                if (!fCodec->skipScanlines(linesToSkip)) {
                    fCodec->fillIncompleteImage(info, pixels, rowBytes, options.fZeroInitialized,
                            dstHeight, y + 1);
                    return SkCodec::kIncompleteInput;
                }
                pixelPtr = SkTAddOffset<void>(pixelPtr, rowBytes);
            }
            return SkCodec::kSuccess;
        }
        case SkCodec::kNone_SkScanlineOrder: {
            const int linesNeeded = subsetHeight - samplingOffsetY;
            SkAutoMalloc storage(linesNeeded * rowBytes);
            uint8_t* storagePtr = static_cast<uint8_t*>(storage.get());

            if (!fCodec->skipScanlines(startY)) {
                fCodec->fillIncompleteImage(info, pixels, rowBytes, options.fZeroInitialized,
                        dstHeight, 0);
                return SkCodec::kIncompleteInput;
            }
            int scanlines = fCodec->getScanlines(storagePtr, linesNeeded, rowBytes);

            for (int y = 0; y < dstHeight; y++) {
                memcpy(pixels, storagePtr, info.minRowBytes());
                storagePtr += sampleY * rowBytes;
                pixels = SkTAddOffset<void>(pixels, rowBytes);
            }

            if (scanlines < dstHeight) {
                // fCodec has already handled filling uninitialized memory.
                return SkCodec::kIncompleteInput;
            }
            return SkCodec::kSuccess;
        }
        default:
            SkASSERT(false);
            return SkCodec::kUnimplemented;
    }
}
<commit_msg>Fix bug in sampled decodes<commit_after>/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "SkCodec.h"
#include "SkCodecPriv.h"
#include "SkMath.h"
#include "SkSampledCodec.h"

SkSampledCodec::SkSampledCodec(SkCodec* codec)
    : INHERITED(codec->getInfo())
    , fCodec(codec)
{}

SkISize SkSampledCodec::accountForNativeScaling(int* sampleSizePtr, int* nativeSampleSize) const {
    SkISize preSampledSize = fCodec->getInfo().dimensions();
    int sampleSize = *sampleSizePtr;
    SkASSERT(sampleSize > 1);

    if (nativeSampleSize) {
        *nativeSampleSize = 1;
    }

    // Only JPEG supports native downsampling.
    if (fCodec->getEncodedFormat() == kJPEG_SkEncodedFormat) {
        // See if libjpeg supports this scale directly
        switch (sampleSize) {
            case 2:
            case 4:
            case 8:
                // This class does not need to do any sampling.
                *sampleSizePtr = 1;
                return fCodec->getScaledDimensions(get_scale_from_sample_size(sampleSize));
            default:
                break;
        }

        // Check if sampleSize is a multiple of something libjpeg can support.
        int remainder;
        const int sampleSizes[] = { 8, 4, 2 };
        for (int supportedSampleSize : sampleSizes) {
            int actualSampleSize;
            SkTDivMod(sampleSize, supportedSampleSize, &actualSampleSize, &remainder);
            if (0 == remainder) {
                float scale = get_scale_from_sample_size(supportedSampleSize);

                // fCodec will scale to this size.
                preSampledSize = fCodec->getScaledDimensions(scale);

                // And then this class will sample it.
                *sampleSizePtr = actualSampleSize;
                if (nativeSampleSize) {
                    *nativeSampleSize = supportedSampleSize;
                }
                break;
            }
        }
    }

    return preSampledSize;
}

SkISize SkSampledCodec::onGetSampledDimensions(int sampleSize) const {
    const SkISize size = this->accountForNativeScaling(&sampleSize);
    return SkISize::Make(get_scaled_dimension(size.width(), sampleSize),
                         get_scaled_dimension(size.height(), sampleSize));
}

SkCodec::Result SkSampledCodec::onGetAndroidPixels(const SkImageInfo& info, void* pixels,
        size_t rowBytes, const AndroidOptions& options) {
    // Create an Options struct for the codec.
    SkCodec::Options codecOptions;
    codecOptions.fZeroInitialized = options.fZeroInitialized;

    SkIRect* subset = options.fSubset;
    if (!subset || subset->size() == fCodec->getInfo().dimensions()) {
        if (fCodec->dimensionsSupported(info.dimensions())) {
            return fCodec->getPixels(info, pixels, rowBytes, &codecOptions, options.fColorPtr,
                    options.fColorCount);
        }

        // If the native codec does not support the requested scale, scale by sampling.
        return this->sampledDecode(info, pixels, rowBytes, options);
    }

    // We are performing a subset decode.
    int sampleSize = options.fSampleSize;
    SkISize scaledSize = this->getSampledDimensions(sampleSize);
    if (!fCodec->dimensionsSupported(scaledSize)) {
        // If the native codec does not support the requested scale, scale by sampling.
        return this->sampledDecode(info, pixels, rowBytes, options);
    }

    // Calculate the scaled subset bounds.
    int scaledSubsetX = subset->x() / sampleSize;
    int scaledSubsetY = subset->y() / sampleSize;
    int scaledSubsetWidth = info.width();
    int scaledSubsetHeight = info.height();

    // Start the scanline decode.
    SkIRect scanlineSubset = SkIRect::MakeXYWH(scaledSubsetX, 0, scaledSubsetWidth,
            scaledSize.height());
    codecOptions.fSubset = &scanlineSubset;
    SkCodec::Result result = fCodec->startScanlineDecode(info.makeWH(scaledSize.width(),
            scaledSize.height()), &codecOptions, options.fColorPtr, options.fColorCount);
    if (SkCodec::kSuccess != result) {
        return result;
    }

    // At this point, we are only concerned with subsetting.  Either no scale was
    // requested, or the fCodec is handling the scale.
    switch (fCodec->getScanlineOrder()) {
        case SkCodec::kTopDown_SkScanlineOrder:
        case SkCodec::kNone_SkScanlineOrder: {
            if (!fCodec->skipScanlines(scaledSubsetY)) {
                fCodec->fillIncompleteImage(info, pixels, rowBytes, options.fZeroInitialized,
                        scaledSubsetHeight, 0);
                return SkCodec::kIncompleteInput;
            }

            int decodedLines = fCodec->getScanlines(pixels, scaledSubsetHeight, rowBytes);
            if (decodedLines != scaledSubsetHeight) {
                return SkCodec::kIncompleteInput;
            }
            return SkCodec::kSuccess;
        }
        default:
            SkASSERT(false);
            return SkCodec::kUnimplemented;
    }
}

SkCodec::Result SkSampledCodec::sampledDecode(const SkImageInfo& info, void* pixels,
        size_t rowBytes, const AndroidOptions& options) {
    // We should only call this function when sampling.
    SkASSERT(options.fSampleSize > 1);

    // Create options struct for the codec.
    SkCodec::Options sampledOptions;
    sampledOptions.fZeroInitialized = options.fZeroInitialized;

    // FIXME: This was already called by onGetAndroidPixels. Can we reduce that?
    int sampleSize = options.fSampleSize;
    int nativeSampleSize;
    SkISize nativeSize = this->accountForNativeScaling(&sampleSize, &nativeSampleSize);

    // Check if there is a subset.
    SkIRect subset;
    int subsetY = 0;
    int subsetWidth = nativeSize.width();
    int subsetHeight = nativeSize.height();
    if (options.fSubset) {
        // We will need to know about subsetting in the y-dimension in order to use the
        // scanline decoder.
        // Update the subset to account for scaling done by fCodec.
        SkIRect* subsetPtr = options.fSubset;

        // Do the divide ourselves, instead of calling get_scaled_dimension. If
        // X and Y are 0, they should remain 0, rather than being upgraded to 1
        // due to being smaller than the sampleSize.
        const int subsetX = subsetPtr->x() / nativeSampleSize;
        subsetY = subsetPtr->y() / nativeSampleSize;

        subsetWidth = get_scaled_dimension(subsetPtr->width(), nativeSampleSize);
        subsetHeight = get_scaled_dimension(subsetPtr->height(), nativeSampleSize);

        // The scanline decoder only needs to be aware of subsetting in the x-dimension.
        subset.setXYWH(subsetX, 0, subsetWidth, nativeSize.height());
        sampledOptions.fSubset = ⊂
    }

    // Start the scanline decode.
    SkCodec::Result result = fCodec->startScanlineDecode(
            info.makeWH(nativeSize.width(), nativeSize.height()), &sampledOptions,
            options.fColorPtr, options.fColorCount);
    if (SkCodec::kSuccess != result) {
        return result;
    }

    SkSampler* sampler = fCodec->getSampler(true);
    if (!sampler) {
        return SkCodec::kUnimplemented;
    }

    // Since we guarantee that output dimensions are always at least one (even if the sampleSize
    // is greater than a given dimension), the input sampleSize is not always the sampleSize that
    // we use in practice.
    const int sampleX = subsetWidth / info.width();
    const int sampleY = subsetHeight / info.height();
    if (sampler->setSampleX(sampleX) != info.width()) {
        return SkCodec::kInvalidScale;
    }
    if (get_scaled_dimension(subsetHeight, sampleY) != info.height()) {
        return SkCodec::kInvalidScale;
    }

    const int samplingOffsetY = get_start_coord(sampleY);
    const int startY = samplingOffsetY + subsetY;
    int dstHeight = info.height();
    switch(fCodec->getScanlineOrder()) {
        case SkCodec::kTopDown_SkScanlineOrder: {
            if (!fCodec->skipScanlines(startY)) {
                fCodec->fillIncompleteImage(info, pixels, rowBytes, options.fZeroInitialized,
                        dstHeight, 0);
                return SkCodec::kIncompleteInput;
            }
            void* pixelPtr = pixels;
            for (int y = 0; y < dstHeight; y++) {
                if (1 != fCodec->getScanlines(pixelPtr, 1, rowBytes)) {
                    fCodec->fillIncompleteImage(info, pixels, rowBytes, options.fZeroInitialized,
                            dstHeight, y + 1);
                    return SkCodec::kIncompleteInput;
                }
                if (y < dstHeight - 1) {
                    if (!fCodec->skipScanlines(sampleY - 1)) {
                        fCodec->fillIncompleteImage(info, pixels, rowBytes,
                                options.fZeroInitialized, dstHeight, y + 1);
                        return SkCodec::kIncompleteInput;
                    }
                }
                pixelPtr = SkTAddOffset<void>(pixelPtr, rowBytes);
            }
            return SkCodec::kSuccess;
        }
        case SkCodec::kNone_SkScanlineOrder: {
            const int linesNeeded = subsetHeight - samplingOffsetY;
            SkAutoMalloc storage(linesNeeded * rowBytes);
            uint8_t* storagePtr = static_cast<uint8_t*>(storage.get());

            if (!fCodec->skipScanlines(startY)) {
                fCodec->fillIncompleteImage(info, pixels, rowBytes, options.fZeroInitialized,
                        dstHeight, 0);
                return SkCodec::kIncompleteInput;
            }
            int scanlines = fCodec->getScanlines(storagePtr, linesNeeded, rowBytes);

            for (int y = 0; y < dstHeight; y++) {
                memcpy(pixels, storagePtr, info.minRowBytes());
                storagePtr += sampleY * rowBytes;
                pixels = SkTAddOffset<void>(pixels, rowBytes);
            }

            if (scanlines < dstHeight) {
                // fCodec has already handled filling uninitialized memory.
                return SkCodec::kIncompleteInput;
            }
            return SkCodec::kSuccess;
        }
        default:
            SkASSERT(false);
            return SkCodec::kUnimplemented;
    }
}
<|endoftext|>


<commit_before>#include <IO/AssimpLoader/AssimpFileLoader.hpp>

#include <Core/Asset/FileData.hpp>
#include <Core/Utils/StringUtils.hpp>

#include <assimp/postprocess.h>
#include <assimp/scene.h>

#include <IO/AssimpLoader/AssimpAnimationDataLoader.hpp>
#include <IO/AssimpLoader/AssimpCameraDataLoader.hpp>
#include <IO/AssimpLoader/AssimpGeometryDataLoader.hpp>
#include <IO/AssimpLoader/AssimpHandleDataLoader.hpp>
#include <IO/AssimpLoader/AssimpLightDataLoader.hpp>

#include <iostream>

namespace Ra {
namespace IO {

using namespace Core::Utils; // log
using namespace Core::Asset;

AssimpFileLoader::AssimpFileLoader() = default;

AssimpFileLoader::~AssimpFileLoader() = default;

std::vector<std::string> AssimpFileLoader::getFileExtensions() const {
    std::string extensionsList;

    m_importer.GetExtensionList( extensionsList );

    // source: https://www.fluentcpp.com/2017/04/21/how-to-split-a-string-in-c/
    std::istringstream iss( extensionsList );
    std::string ext;
    std::vector<std::string> extensions;
    while ( std::getline( iss, ext, ';' ) )
    {
        extensions.push_back( ext );
    }
    return extensions;
}

bool AssimpFileLoader::handleFileExtension( const std::string& extension ) const {
    return m_importer.IsExtensionSupported( extension );
}

FileData* AssimpFileLoader::loadFile( const std::string& filename ) {
    auto fileData = new FileData( filename );

    if ( !fileData->isInitialized() ) { return nullptr; }

    const aiScene* scene = m_importer.ReadFile(
        fileData->getFileName(),
        aiProcess_GenSmoothNormals | aiProcess_SortByPType | aiProcess_FixInfacingNormals |
            aiProcess_CalcTangentSpace | aiProcess_GenUVCoords );

    if ( scene == nullptr )
    {
        LOG( logINFO ) << "File \"" << fileData->getFileName()
                       << "\" assimp error : " << m_importer.GetErrorString() << ".";
        return nullptr;
    }

    if ( fileData->isVerbose() ) { LOG( logINFO ) << "File Loading begin..."; }

    std::clock_t startTime;
    startTime = std::clock();

    // FIXME : this workaround is related to assimp issue
    // #2260 Mesh created for a light only file (collada)
    // https://github.com/assimp/assimp/issues/2260
    if ( scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE )
    {
        LOG( logWARNING )
            << " ai scene is incomplete, just try to load lights or skeletons (but not both).";

        AssimpLightDataLoader lightLoader( Core::Utils::getDirName( filename ),
                                           fileData->isVerbose() );
        lightLoader.loadData( scene, fileData->m_lightData );

        if ( !fileData->hasLight() )
        {
            AssimpHandleDataLoader handleLoader( fileData->isVerbose() );
            handleLoader.loadData( scene, fileData->m_handleData );

            AssimpAnimationDataLoader animationLoader( fileData->isVerbose() );
            animationLoader.loadData( scene, fileData->m_animationData );
        }
    }
    else
    {
        AssimpGeometryDataLoader geometryLoader( Core::Utils::getDirName( filename ),
                                                 fileData->isVerbose() );
        geometryLoader.loadData( scene, fileData->m_geometryData );

        // check if that the scene contains at least one mesh
        // Note that currently, Assimp is ALWAYS creating faces, even when
        // loading point clouds
        // (see 3rdPartyLibraries/Assimp/code/PlyLoader.cpp:260)
        bool ok = std::any_of( fileData->m_geometryData.begin(),
                               fileData->m_geometryData.end(),
                               []( const auto& geom ) -> bool { return geom->hasFaces(); } );
        if ( !ok )
        {
            if ( fileData->isVerbose() ) { LOG( logINFO ) << "Point-cloud found. Aborting"; }
            delete fileData;
            return nullptr;
        }

        AssimpHandleDataLoader handleLoader( fileData->isVerbose() );
        handleLoader.loadData( scene, fileData->m_handleData );

        AssimpAnimationDataLoader animationLoader( fileData->isVerbose() );
        animationLoader.loadData( scene, fileData->m_animationData );

        AssimpLightDataLoader lightLoader( Core::Utils::getDirName( filename ),
                                           fileData->isVerbose() );
        lightLoader.loadData( scene, fileData->m_lightData );
        AssimpCameraDataLoader cameraLoader( fileData->isVerbose() );
        cameraLoader.loadData( scene, fileData->m_cameraData );
    }

    fileData->m_loadingTime = ( std::clock() - startTime ) / Scalar( CLOCKS_PER_SEC );

    if ( fileData->isVerbose() )
    {
        LOG( logINFO ) << "File Loading end.";

        fileData->displayInfo();
    }

    fileData->m_processed = true;

    return fileData;
}

std::string AssimpFileLoader::name() const {
    return "Assimp";
}
} // namespace IO
} // namespace Ra
<commit_msg>Remove FixInfacingNormals assimp process<commit_after>#include <IO/AssimpLoader/AssimpFileLoader.hpp>

#include <Core/Asset/FileData.hpp>
#include <Core/Utils/StringUtils.hpp>

#include <assimp/postprocess.h>
#include <assimp/scene.h>

#include <IO/AssimpLoader/AssimpAnimationDataLoader.hpp>
#include <IO/AssimpLoader/AssimpCameraDataLoader.hpp>
#include <IO/AssimpLoader/AssimpGeometryDataLoader.hpp>
#include <IO/AssimpLoader/AssimpHandleDataLoader.hpp>
#include <IO/AssimpLoader/AssimpLightDataLoader.hpp>

#include <iostream>

namespace Ra {
namespace IO {

using namespace Core::Utils; // log
using namespace Core::Asset;

AssimpFileLoader::AssimpFileLoader() = default;

AssimpFileLoader::~AssimpFileLoader() = default;

std::vector<std::string> AssimpFileLoader::getFileExtensions() const {
    std::string extensionsList;

    m_importer.GetExtensionList( extensionsList );

    // source: https://www.fluentcpp.com/2017/04/21/how-to-split-a-string-in-c/
    std::istringstream iss( extensionsList );
    std::string ext;
    std::vector<std::string> extensions;
    while ( std::getline( iss, ext, ';' ) )
    {
        extensions.push_back( ext );
    }
    return extensions;
}

bool AssimpFileLoader::handleFileExtension( const std::string& extension ) const {
    return m_importer.IsExtensionSupported( extension );
}

FileData* AssimpFileLoader::loadFile( const std::string& filename ) {
    auto fileData = new FileData( filename );

    if ( !fileData->isInitialized() ) { return nullptr; }

    /*
     * TODO : allow user to parameterize assimp process on loaded meshes
     */
    const aiScene* scene =
        m_importer.ReadFile( fileData->getFileName(),
                             aiProcess_GenSmoothNormals | aiProcess_SortByPType |
                                 aiProcess_CalcTangentSpace | aiProcess_GenUVCoords );

    if ( scene == nullptr )
    {
        LOG( logINFO ) << "File \"" << fileData->getFileName()
                       << "\" assimp error : " << m_importer.GetErrorString() << ".";
        return nullptr;
    }

    if ( fileData->isVerbose() ) { LOG( logINFO ) << "File Loading begin..."; }

    std::clock_t startTime;
    startTime = std::clock();

    // FIXME : this workaround is related to assimp issue
    // #2260 Mesh created for a light only file (collada)
    // https://github.com/assimp/assimp/issues/2260
    if ( scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE )
    {
        LOG( logWARNING )
            << " ai scene is incomplete, just try to load lights or skeletons (but not both).";

        AssimpLightDataLoader lightLoader( Core::Utils::getDirName( filename ),
                                           fileData->isVerbose() );
        lightLoader.loadData( scene, fileData->m_lightData );

        if ( !fileData->hasLight() )
        {
            AssimpHandleDataLoader handleLoader( fileData->isVerbose() );
            handleLoader.loadData( scene, fileData->m_handleData );

            AssimpAnimationDataLoader animationLoader( fileData->isVerbose() );
            animationLoader.loadData( scene, fileData->m_animationData );
        }
    }
    else
    {
        AssimpGeometryDataLoader geometryLoader( Core::Utils::getDirName( filename ),
                                                 fileData->isVerbose() );
        geometryLoader.loadData( scene, fileData->m_geometryData );

        // check if that the scene contains at least one mesh
        // Note that currently, Assimp is ALWAYS creating faces, even when
        // loading point clouds
        // (see 3rdPartyLibraries/Assimp/code/PlyLoader.cpp:260)
        bool ok = std::any_of( fileData->m_geometryData.begin(),
                               fileData->m_geometryData.end(),
                               []( const auto& geom ) -> bool { return geom->hasFaces(); } );
        if ( !ok )
        {
            if ( fileData->isVerbose() ) { LOG( logINFO ) << "Point-cloud found. Aborting"; }
            delete fileData;
            return nullptr;
        }

        AssimpHandleDataLoader handleLoader( fileData->isVerbose() );
        handleLoader.loadData( scene, fileData->m_handleData );

        AssimpAnimationDataLoader animationLoader( fileData->isVerbose() );
        animationLoader.loadData( scene, fileData->m_animationData );

        AssimpLightDataLoader lightLoader( Core::Utils::getDirName( filename ),
                                           fileData->isVerbose() );
        lightLoader.loadData( scene, fileData->m_lightData );
        AssimpCameraDataLoader cameraLoader( fileData->isVerbose() );
        cameraLoader.loadData( scene, fileData->m_cameraData );
    }

    fileData->m_loadingTime = ( std::clock() - startTime ) / Scalar( CLOCKS_PER_SEC );

    if ( fileData->isVerbose() )
    {
        LOG( logINFO ) << "File Loading end.";

        fileData->displayInfo();
    }

    fileData->m_processed = true;

    return fileData;
}

std::string AssimpFileLoader::name() const {
    return "Assimp";
}
} // namespace IO
} // namespace Ra
<|endoftext|>


<commit_before>/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

//-------------------------------------------------------------------------
//               Implementation of the V0 vertexer class
//                  reads tracks writes out V0 vertices
//                      fills the ESD with the V0s
//     Origin: Iouri Belikov, IPHC, Strasbourg, Jouri.Belikov@cern.ch
//-------------------------------------------------------------------------

#include "AliESDEvent.h"
#include "AliESDv0.h"
#include "AliV0vertexer.h"

ClassImp(AliV0vertexer)

//A set of very loose cuts
Double_t AliV0vertexer::fgChi2max=33.; //max chi2
Double_t AliV0vertexer::fgDNmin=0.05;  //min imp parameter for the 1st daughter
Double_t AliV0vertexer::fgDPmin=0.05;  //min imp parameter for the 2nd daughter
Double_t AliV0vertexer::fgDCAmax=1.5;  //max DCA between the daughter tracks
Double_t AliV0vertexer::fgCPAmin=0.9;  //min cosine of V0's pointing angle
Double_t AliV0vertexer::fgRmin=0.2;    //min radius of the fiducial volume
Double_t AliV0vertexer::fgRmax=200.;   //max radius of the fiducial volume

Int_t AliV0vertexer::Tracks2V0vertices(AliESDEvent *event) {
  //--------------------------------------------------------------------
  //This function reconstructs V0 vertices
  //--------------------------------------------------------------------

   const AliESDVertex *vtxT3D=event->GetPrimaryVertex();

   Double_t xPrimaryVertex=vtxT3D->GetXv();
   Double_t yPrimaryVertex=vtxT3D->GetYv();
   Double_t zPrimaryVertex=vtxT3D->GetZv();

   Int_t nentr=event->GetNumberOfTracks();
   Double_t b=event->GetMagneticField();

   if (nentr<2) return 0;

   TArrayI neg(nentr);
   TArrayI pos(nentr);

   Int_t nneg=0, npos=0, nvtx=0;

   Int_t i;
   for (i=0; i<nentr; i++) {
     AliESDtrack *esdTrack=event->GetTrack(i);
     ULong_t status=esdTrack->GetStatus();

     //if ((status&AliESDtrack::kITSrefit)==0)//not to accept the ITS SA tracks
        if ((status&AliESDtrack::kTPCrefit)==0) continue;

     Double_t d=esdTrack->GetD(xPrimaryVertex,yPrimaryVertex,b);
     if (TMath::Abs(d)<fDPmin) continue;
     if (TMath::Abs(d)>fRmax) continue;

     if (esdTrack->GetSign() < 0.) neg[nneg++]=i;
     else pos[npos++]=i;
   }

   for (i=0; i<nneg; i++) {
      Int_t nidx=neg[i];
      AliESDtrack *ntrk=event->GetTrack(nidx);

      for (Int_t k=0; k<npos; k++) {
         Int_t pidx=pos[k];
	 AliESDtrack *ptrk=event->GetTrack(pidx);

         if (TMath::Abs(ntrk->GetD(xPrimaryVertex,yPrimaryVertex,b))<fDNmin)
	   if (TMath::Abs(ptrk->GetD(xPrimaryVertex,yPrimaryVertex,b))<fDNmin) continue;

         Double_t xn, xp, dca=ntrk->GetDCA(ptrk,b,xn,xp);
         if (dca > fDCAmax) continue;
         if ((xn+xp) > 2*fRmax) continue;
         if ((xn+xp) < 2*fRmin) continue;

         AliExternalTrackParam nt(*ntrk), pt(*ptrk);
         Bool_t corrected=kFALSE;
         if ((nt.GetX() > 3.) && (xn < 3.)) {
	   //correct for the beam pipe material
           corrected=kTRUE;
         }
         if ((pt.GetX() > 3.) && (xp < 3.)) {
	   //correct for the beam pipe material
           corrected=kTRUE;
         }
         if (corrected) {
	   dca=nt.GetDCA(&pt,b,xn,xp);
           if (dca > fDCAmax) continue;
           if ((xn+xp) > 2*fRmax) continue;
           if ((xn+xp) < 2*fRmin) continue;
	 }

         nt.PropagateTo(xn,b); pt.PropagateTo(xp,b);

         AliESDv0 vertex(nt,nidx,pt,pidx);
         if (vertex.GetChi2V0() > fChi2max) continue;

         Double_t x=vertex.Xv(), y=vertex.Yv();
         Double_t r2=x*x + y*y;
         if (r2 < fRmin*fRmin) continue;
         if (r2 > fRmax*fRmax) continue;

	 Float_t cpa=vertex.GetV0CosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);
	 if (cpa < fCPAmin) continue;
	 vertex.SetDcaV0Daughters(dca);
         vertex.SetV0CosineOfPointingAngle(cpa);
         vertex.ChangeMassHypothesis(kK0Short);

         event->AddV0(&vertex);

         nvtx++;
      }
   }

   Info("Tracks2V0vertices","Number of reconstructed V0 vertices: %d",nvtx);

   return nvtx;
}

<commit_msg>The cut on V0 pointing angle is now momentum dependent below 1.5 GeV/c. Above this threshold, it is constant as it was before.<commit_after>/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

//-------------------------------------------------------------------------
//               Implementation of the V0 vertexer class
//                  reads tracks writes out V0 vertices
//                      fills the ESD with the V0s
//     Origin: Iouri Belikov, IPHC, Strasbourg, Jouri.Belikov@cern.ch
//-------------------------------------------------------------------------

#include "AliESDEvent.h"
#include "AliESDv0.h"
#include "AliV0vertexer.h"

ClassImp(AliV0vertexer)

//A set of very loose cuts
Double_t AliV0vertexer::fgChi2max=33.; //max chi2
Double_t AliV0vertexer::fgDNmin=0.05;  //min imp parameter for the 1st daughter
Double_t AliV0vertexer::fgDPmin=0.05;  //min imp parameter for the 2nd daughter
Double_t AliV0vertexer::fgDCAmax=1.5;  //max DCA between the daughter tracks
Double_t AliV0vertexer::fgCPAmin=0.9;  //min cosine of V0's pointing angle
Double_t AliV0vertexer::fgRmin=0.2;    //min radius of the fiducial volume
Double_t AliV0vertexer::fgRmax=200.;   //max radius of the fiducial volume

Int_t AliV0vertexer::Tracks2V0vertices(AliESDEvent *event) {
  //--------------------------------------------------------------------
  //This function reconstructs V0 vertices
  //--------------------------------------------------------------------

   const AliESDVertex *vtxT3D=event->GetPrimaryVertex();

   Double_t xPrimaryVertex=vtxT3D->GetXv();
   Double_t yPrimaryVertex=vtxT3D->GetYv();
   Double_t zPrimaryVertex=vtxT3D->GetZv();

   Int_t nentr=event->GetNumberOfTracks();
   Double_t b=event->GetMagneticField();

   if (nentr<2) return 0;

   TArrayI neg(nentr);
   TArrayI pos(nentr);

   Int_t nneg=0, npos=0, nvtx=0;

   Int_t i;
   for (i=0; i<nentr; i++) {
     AliESDtrack *esdTrack=event->GetTrack(i);
     ULong_t status=esdTrack->GetStatus();

     //if ((status&AliESDtrack::kITSrefit)==0)//not to accept the ITS SA tracks
        if ((status&AliESDtrack::kTPCrefit)==0) continue;

     Double_t d=esdTrack->GetD(xPrimaryVertex,yPrimaryVertex,b);
     if (TMath::Abs(d)<fDPmin) continue;
     if (TMath::Abs(d)>fRmax) continue;

     if (esdTrack->GetSign() < 0.) neg[nneg++]=i;
     else pos[npos++]=i;
   }

   for (i=0; i<nneg; i++) {
      Int_t nidx=neg[i];
      AliESDtrack *ntrk=event->GetTrack(nidx);

      for (Int_t k=0; k<npos; k++) {
         Int_t pidx=pos[k];
	 AliESDtrack *ptrk=event->GetTrack(pidx);

         if (TMath::Abs(ntrk->GetD(xPrimaryVertex,yPrimaryVertex,b))<fDNmin)
	   if (TMath::Abs(ptrk->GetD(xPrimaryVertex,yPrimaryVertex,b))<fDNmin) continue;

         Double_t xn, xp, dca=ntrk->GetDCA(ptrk,b,xn,xp);
         if (dca > fDCAmax) continue;
         if ((xn+xp) > 2*fRmax) continue;
         if ((xn+xp) < 2*fRmin) continue;

         AliExternalTrackParam nt(*ntrk), pt(*ptrk);
         Bool_t corrected=kFALSE;
         if ((nt.GetX() > 3.) && (xn < 3.)) {
	   //correct for the beam pipe material
           corrected=kTRUE;
         }
         if ((pt.GetX() > 3.) && (xp < 3.)) {
	   //correct for the beam pipe material
           corrected=kTRUE;
         }
         if (corrected) {
	   dca=nt.GetDCA(&pt,b,xn,xp);
           if (dca > fDCAmax) continue;
           if ((xn+xp) > 2*fRmax) continue;
           if ((xn+xp) < 2*fRmin) continue;
	 }

         nt.PropagateTo(xn,b); pt.PropagateTo(xp,b);

         AliESDv0 vertex(nt,nidx,pt,pidx);
         if (vertex.GetChi2V0() > fChi2max) continue;

         Double_t x=vertex.Xv(), y=vertex.Yv();
         Double_t r2=x*x + y*y;
         if (r2 < fRmin*fRmin) continue;
         if (r2 > fRmax*fRmax) continue;

	 Float_t cpa=vertex.GetV0CosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);
         const Double_t pThr=1.5;
         Double_t pv0=vertex.P();
         if (pv0<pThr) {
           //Below the threshold "pThr", try a momentum dependent cos(PA) cut
           const Double_t bend=0.03; // approximate Xi bending angle
           const Double_t qt=0.211;  // max Lambda pT in Xi decay
           const Double_t cpaThr=TMath::Cos(TMath::ASin(qt/pThr) + bend);
           Double_t
           cpaCut=(fCPAmin/cpaThr)*TMath::Cos(TMath::ASin(qt/pv0) + bend);
           if (cpa < cpaCut) continue;
         }
	 if (cpa < fCPAmin) continue;

	 vertex.SetDcaV0Daughters(dca);
         vertex.SetV0CosineOfPointingAngle(cpa);
         vertex.ChangeMassHypothesis(kK0Short);

         event->AddV0(&vertex);

         nvtx++;
      }
   }

   Info("Tracks2V0vertices","Number of reconstructed V0 vertices: %d",nvtx);

   return nvtx;
}

<|endoftext|>


<commit_before>/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit (ITK)
  Module:
  Language:  C++
  Date:
  Version:

Copyright (c) 2000 National Library of Medicine
All rights reserved.

See COPYRIGHT.txt for copyright details.

=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif

#include <iostream>
// This file has been generated by BuildHeaderTest.tcl
// Test to include each header file for Insight

#include "itkAcosImageAdaptor.h"
#include "itkAddImageAdaptor.h"
#include "itkAddPixelAccessor.h"
#include "itkAffineTransform.txx"
#include "itkArray.txx"
#include "itkArray2D.txx"
#include "itkAsinImageAdaptor.h"
#include "itkAtanImageAdaptor.h"
#include "itkAutoPointer.h"
#include "itkAzimuthElevationToCartesianTransform.txx"
#include "itkBSplineDeformableTransform.txx"
#include "itkBSplineDerivativeKernelFunction.h"
#include "itkBSplineInterpolationWeightFunction.txx"
#include "itkBSplineKernelFunction.h"
#include "itkBackwardDifferenceOperator.txx"
#include "itkBinaryBallStructuringElement.txx"
#include "itkBinaryThresholdImageFunction.txx"
#include "itkBloxBoundaryPointImage.txx"
#include "itkBloxBoundaryPointItem.txx"
#include "itkBloxBoundaryPointPixel.txx"
#include "itkBloxBoundaryProfileImage.txx"
#include "itkBloxBoundaryProfileItem.txx"
#include "itkBloxBoundaryProfilePixel.txx"
#include "itkBloxCoreAtomImage.txx"
#include "itkBloxCoreAtomItem.txx"
#include "itkBloxCoreAtomPixel.txx"
#include "itkBloxImage.txx"
#include "itkBloxItem.h"
#include "itkBloxPixel.txx"
#include "itkBluePixelAccessor.h"
#include "itkBoundingBox.txx"
#include "itkByteSwapper.txx"
#include "itkCellInterface.txx"
#include "itkCellInterfaceVisitor.h"
#include "itkCenteredAffineTransform.txx"
#include "itkCenteredRigid2DTransform.txx"
#include "itkCenteredTransformInitializer.txx"
#include "itkCentralDifferenceImageFunction.txx"
#include "itkChainCodePath.txx"
#include "itkChainCodePath2D.txx"
#include "itkColorTable.txx"
#include "itkCommand.h"
#include "itkConceptChecking.h"
#include "itkConditionalConstIterator.txx"
#include "itkConditionalIterator.txx"
#include "itkConicShellInteriorExteriorSpatialFunction.txx"
#include "itkConstNeighborhoodIterator.txx"
#include "itkConstShapedNeighborhoodIterator.txx"
#include "itkConstSliceIterator.h"
#include "itkConstantBoundaryCondition.h"
#include "itkContinuousIndex.h"
#include "itkCosImageAdaptor.h"
#include "itkCovariantVector.txx"
#include "itkCreateObjectFunction.h"
#include "itkDataObject.h"
#include "itkDecisionRuleBase.h"
#include "itkDefaultDynamicMeshTraits.h"
#include "itkDefaultImageTraits.h"
#include "itkDefaultPixelAccessor.h"
#include "itkDefaultStaticMeshTraits.h"
#include "itkDenseFiniteDifferenceImageFilter.txx"
#include "itkDerivativeOperator.txx"
#include "itkDifferenceImageFilter.txx"
#include "itkDirectory.h"
#include "itkDynamicLoader.h"
#include "itkElasticBodyReciprocalSplineKernelTransform.txx"
#include "itkElasticBodySplineKernelTransform.txx"
#include "itkEllipsoidInteriorExteriorSpatialFunction.txx"
#include "itkEquivalencyTable.h"
#include "itkEuler2DTransform.txx"
#include "itkEuler3DTransform.txx"
#include "itkEventObject.h"
#include "itkExceptionObject.h"
#include "itkExpImageAdaptor.h"
#include "itkExpNegativeImageAdaptor.h"
#include "itkFastMutexLock.h"
#include "itkFileOutputWindow.h"
#include "itkFiniteDifferenceFunction.txx"
#include "itkFiniteDifferenceImageFilter.txx"
#include "itkFixedArray.txx"
#include "itkFixedCenterOfRotationAffineTransform.txx"
#include "itkFloodFilledFunctionConditionalConstIterator.txx"
#include "itkFloodFilledFunctionConditionalIterator.txx"
#include "itkFloodFilledImageFunctionConditionalConstIterator.txx"
#include "itkFloodFilledImageFunctionConditionalIterator.txx"
#include "itkFloodFilledSpatialFunctionConditionalConstIterator.txx"
#include "itkFloodFilledSpatialFunctionConditionalIterator.txx"
#include "itkForwardDifferenceOperator.txx"
#include "itkFourierSeriesPath.txx"
#include "itkFrustumSpatialFunction.txx"
#include "itkFunctionBase.h"
#include "itkGaussianBlurImageFunction.txx"
#include "itkGaussianDerivativeImageFunction.txx"
#include "itkGaussianDerivativeSpatialFunction.txx"
#include "itkGaussianKernelFunction.h"
#include "itkGaussianOperator.txx"
#include "itkGaussianSpatialFunction.txx"
#include "itkGreenPixelAccessor.h"
#include "itkHexahedronCell.txx"
#include "itkHexahedronCellTopology.h"
#include "itkIdentityTransform.h"
#include "itkImage.txx"
#include "itkImageAdaptor.txx"
#include "itkImageBase.txx"
#include "itkImageBoundaryCondition.h"
#include "itkImageConstIterator.txx"
#include "itkImageConstIteratorWithIndex.txx"
#include "itkImageContainerInterface.h"
#include "itkImageFunction.txx"
#include "itkImageIterator.txx"
#include "itkImageIteratorWithIndex.txx"
#include "itkImageLinearConstIteratorWithIndex.txx"
#include "itkImageLinearIteratorWithIndex.txx"
#include "itkImageRandomConstIteratorWithIndex.txx"
#include "itkImageRandomIteratorWithIndex.txx"
#include "itkImageRegion.txx"
#include "itkImageRegionConstIterator.txx"
#include "itkImageRegionConstIteratorWithIndex.txx"
#include "itkImageRegionExclusionConstIteratorWithIndex.txx"
#include "itkImageRegionExclusionIteratorWithIndex.txx"
#include "itkImageRegionIterator.txx"
#include "itkImageRegionIteratorWithIndex.txx"
#include "itkImageRegionMultidimensionalSplitter.txx"
#include "itkImageRegionReverseConstIterator.txx"
#include "itkImageRegionReverseIterator.txx"
#include "itkImageRegionSplitter.txx"
#include "itkImageReverseConstIterator.txx"
#include "itkImageReverseIterator.txx"
#include "itkImageSliceConstIteratorWithIndex.txx"
#include "itkImageSliceIteratorWithIndex.txx"
#include "itkImageSource.txx"
#include "itkImageToImageFilter.txx"
#include "itkImageToImageFilterDetail.h"
#include "itkImportImageContainer.txx"
#include "itkInPlaceImageFilter.txx"
#include "itkIndent.h"
#include "itkIndex.h"
#include "itkIndexedContainerInterface.h"
#include "itkIntTypes.h"
#include "itkInteriorExteriorSpatialFunction.txx"
#include "itkInterpolateImageFunction.h"
#include "itkIterationReporter.h"
#include "itkKLMSegmentationBorder.h"
#include "itkKLMSegmentationRegion.h"
#include "itkKernelFunction.h"
#include "itkKernelTransform.txx"
#include "itkLaplacianOperator.txx"
#include "itkLevelSet.h"
#include "itkLevelSetFunction.txx"
#include "itkLevelSetFunctionBase.txx"
#include "itkLightObject.h"
#include "itkLightProcessObject.h"
#include "itkLineCell.txx"
#include "itkLinearInterpolateImageFunction.txx"
#include "itkLog10ImageAdaptor.h"
#include "itkLogImageAdaptor.h"
#include "itkMacro.h"
#include "itkMapContainer.txx"
#include "itkMatrix.txx"
#include "itkMaximumDecisionRule.h"
#include "itkMaximumRatioDecisionRule.h"
#include "itkMeanImageFunction.txx"
#include "itkMedianImageFunction.txx"
#include "itkMesh.txx"
#include "itkMeshRegion.h"
#include "itkMeshSource.txx"
#include "itkMeshToMeshFilter.txx"
#include "itkMetaDataDictionary.h"
#include "itkMetaDataObject.txx"
#include "itkMetaDataObjectBase.h"
#include "itkMinimumDecisionRule.h"
#include "itkMultiThreader.h"
#include "itkMutexLock.h"
#include "itkMutexLockHolder.h"
#include "itkNearestNeighborInterpolateImageFunction.h"
#include "itkNeighborhood.txx"
#include "itkNeighborhoodAlgorithm.txx"
#include "itkNeighborhoodAllocator.h"
#include "itkNeighborhoodBinaryThresholdImageFunction.txx"
#include "itkNeighborhoodInnerProduct.txx"
#include "itkNeighborhoodIterator.txx"
#include "itkNeighborhoodOperator.txx"
#include "itkNeighborhoodOperatorImageFunction.txx"
#include "itkNthElementImageAdaptor.h"
#include "itkNthElementPixelAccessor.h"
#include "itkNumericTraits.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkObjectFactoryBase.h"
#include "itkObjectStore.txx"
#include "itkOctree.txx"
#include "itkOctreeNode.h"
#include "itkOffset.h"
#include "itkOneWayEquivalencyTable.h"
#include "itkOutputWindow.h"
#include "itkParametricPath.txx"
#include "itkPath.h"
#include "itkPathConstIterator.txx"
#include "itkPathFunctions.h"
#include "itkPathIterator.txx"
#include "itkPeriodicBoundaryCondition.txx"
#include "itkPixelAccessor.h"
#include "itkPixelTraits.h"
#include "itkPoint.txx"
#include "itkPointLocator.txx"
#include "itkPointSet.txx"
#include "itkPolyLineParametricPath.txx"
#include "itkPolygonCell.txx"
#include "itkProcessObject.h"
#include "itkProgressAccumulator.h"
#include "itkProgressReporter.h"
#include "itkQuadraticEdgeCell.txx"
#include "itkQuadraticTriangleCell.txx"
#include "itkQuadraticTriangleCellTopology.h"
#include "itkQuadrilateralCell.txx"
#include "itkQuadrilateralCellTopology.h"
#include "itkQuaternionRigidTransform.txx"
#include "itkRGBAPixel.txx"
#include "itkRGBPixel.txx"
#include "itkRGBToVectorImageAdaptor.h"
#include "itkRGBToVectorPixelAccessor.h"
#include "itkRedPixelAccessor.h"
#include "itkRegion.h"
#include "itkRigid2DTransform.txx"
#include "itkRigid3DPerspectiveTransform.txx"
#include "itkRigid3DTransform.txx"
#include "itkSTLConstContainerAdaptor.h"
#include "itkSTLContainerAdaptor.h"
#include "itkScalarToRGBPixelFunctor.txx"
#include "itkScalarVector.h"
#include "itkScaleTransform.txx"
#include "itkSegmentationBorder.h"
#include "itkSegmentationLevelSetFunction.txx"
#include "itkSegmentationRegion.h"
#include "itkShapedNeighborhoodIterator.txx"
#include "itkSimilarity2DTransform.txx"
#include "itkSimpleFastMutexLock.h"
#include "itkSinImageAdaptor.h"
#include "itkSize.h"
#include "itkSliceIterator.h"
#include "itkSmartPointer.h"
#include "itkSmartPointerForwardReference.txx"
#include "itkSobelOperator.txx"
#include "itkSpatialFunction.txx"
#include "itkSphereSpatialFunction.txx"
#include "itkSqrtImageAdaptor.h"
#include "itkSymmetricEllipsoidInteriorExteriorSpatialFunction.txx"
#include "itkTanImageAdaptor.h"
#include "itkTetrahedronCell.txx"
#include "itkTetrahedronCellTopology.h"
#include "itkTextOutput.h"
#include "itkThinPlateR2LogRSplineKernelTransform.txx"
#include "itkThinPlateSplineKernelTransform.txx"
#include "itkTimeProbe.h"
#include "itkTimeProbesCollectorBase.h"
#include "itkTimeStamp.h"
#include "itkTorusInteriorExteriorSpatialFunction.txx"
#include "itkTransform.txx"
#include "itkTranslationTransform.txx"
#include "itkTriangleCell.txx"
#include "itkTriangleCellTopology.h"
#include "itkValarrayImageContainer.h"
#include "itkVarianceImageFunction.txx"
#include "itkVector.txx"
#include "itkVectorContainer.txx"
#include "itkVectorInterpolateImageFunction.h"
#include "itkVectorLinearInterpolateImageFunction.txx"
#include "itkVectorNeighborhoodInnerProduct.txx"
#include "itkVectorToRGBImageAdaptor.h"
#include "itkVectorToRGBPixelAccessor.h"
#include "itkVersion.h"
#include "itkVersor.txx"
#include "itkVersorRigid3DTransform.txx"
#include "itkVersorTransform.txx"
#include "itkVertexCell.txx"
#include "itkVolumeSplineKernelTransform.txx"
#include "itkWeakPointer.h"
#include "itkXMLFileOutputWindow.h"
#include "itkZeroFluxNeumannBoundaryCondition.txx"
#include "itk_alloc.h"
#include "itk_hash_map.h"
#include "itk_hash_set.h"
#include "itk_hashtable.h"
#include "vcl_alloc.h"

int main ( int , char*  )
{

  return 0;
}

<commit_msg>ENH: Updated to latest headers<commit_after>/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit (ITK)
  Module:
  Language:  C++
  Date:
  Version:

Copyright (c) 2000 National Library of Medicine
All rights reserved.

See COPYRIGHT.txt for copyright details.

=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif

#include <iostream>
// This file has been generated by BuildHeaderTest.tcl
// Test to include each header file for Insight

#include "itkAcosImageAdaptor.h"
#include "itkAddImageAdaptor.h"
#include "itkAddPixelAccessor.h"
#include "itkAffineTransform.txx"
#include "itkArray.txx"
#include "itkArray2D.txx"
#include "itkAsinImageAdaptor.h"
#include "itkAtanImageAdaptor.h"
#include "itkAutoPointer.h"
#include "itkAzimuthElevationToCartesianTransform.txx"
#include "itkBSplineDeformableTransform.txx"
#include "itkBSplineDerivativeKernelFunction.h"
#include "itkBSplineInterpolationWeightFunction.txx"
#include "itkBSplineKernelFunction.h"
#include "itkBackwardDifferenceOperator.txx"
#include "itkBinaryBallStructuringElement.txx"
#include "itkBinaryThresholdImageFunction.txx"
#include "itkBloxBoundaryPointImage.txx"
#include "itkBloxBoundaryPointItem.txx"
#include "itkBloxBoundaryPointPixel.txx"
#include "itkBloxBoundaryProfileImage.txx"
#include "itkBloxBoundaryProfileItem.txx"
#include "itkBloxBoundaryProfilePixel.txx"
#include "itkBloxCoreAtomImage.txx"
#include "itkBloxCoreAtomItem.txx"
#include "itkBloxCoreAtomPixel.txx"
#include "itkBloxImage.txx"
#include "itkBloxItem.h"
#include "itkBloxPixel.txx"
#include "itkBluePixelAccessor.h"
#include "itkBoundingBox.txx"
#include "itkByteSwapper.txx"
#include "itkCellInterface.txx"
#include "itkCellInterfaceVisitor.h"
#include "itkCenteredAffineTransform.txx"
#include "itkCenteredRigid2DTransform.txx"
#include "itkCenteredTransformInitializer.txx"
#include "itkCentralDifferenceImageFunction.txx"
#include "itkChainCodePath.txx"
#include "itkChainCodePath2D.txx"
#include "itkColorTable.txx"
#include "itkCommand.h"
#include "itkConceptChecking.h"
#include "itkConditionalConstIterator.txx"
#include "itkConditionalIterator.txx"
#include "itkConicShellInteriorExteriorSpatialFunction.txx"
#include "itkConstNeighborhoodIterator.txx"
#include "itkConstShapedNeighborhoodIterator.txx"
#include "itkConstSliceIterator.h"
#include "itkConstantBoundaryCondition.h"
#include "itkContinuousIndex.h"
#include "itkCosImageAdaptor.h"
#include "itkCovariantVector.txx"
#include "itkCreateObjectFunction.h"
#include "itkDataObject.h"
#include "itkDecisionRuleBase.h"
#include "itkDefaultDynamicMeshTraits.h"
#include "itkDefaultImageTraits.h"
#include "itkDefaultPixelAccessor.h"
#include "itkDefaultStaticMeshTraits.h"
#include "itkDenseFiniteDifferenceImageFilter.txx"
#include "itkDerivativeOperator.txx"
#include "itkDifferenceImageFilter.txx"
#include "itkDirectory.h"
#include "itkDynamicLoader.h"
#include "itkElasticBodyReciprocalSplineKernelTransform.txx"
#include "itkElasticBodySplineKernelTransform.txx"
#include "itkEllipsoidInteriorExteriorSpatialFunction.txx"
#include "itkEquivalencyTable.h"
#include "itkEuler2DTransform.txx"
#include "itkEuler3DTransform.txx"
#include "itkEventObject.h"
#include "itkExceptionObject.h"
#include "itkExpImageAdaptor.h"
#include "itkExpNegativeImageAdaptor.h"
#include "itkFastMutexLock.h"
#include "itkFileOutputWindow.h"
#include "itkFiniteDifferenceFunction.txx"
#include "itkFiniteDifferenceImageFilter.txx"
#include "itkFixedArray.txx"
#include "itkFixedCenterOfRotationAffineTransform.txx"
#include "itkFloodFilledFunctionConditionalConstIterator.txx"
#include "itkFloodFilledFunctionConditionalIterator.txx"
#include "itkFloodFilledImageFunctionConditionalConstIterator.txx"
#include "itkFloodFilledImageFunctionConditionalIterator.txx"
#include "itkFloodFilledSpatialFunctionConditionalConstIterator.txx"
#include "itkFloodFilledSpatialFunctionConditionalIterator.txx"
#include "itkForwardDifferenceOperator.txx"
#include "itkFourierSeriesPath.txx"
#include "itkFrustumSpatialFunction.txx"
#include "itkFunctionBase.h"
#include "itkGaussianBlurImageFunction.txx"
#include "itkGaussianDerivativeImageFunction.txx"
#include "itkGaussianDerivativeSpatialFunction.txx"
#include "itkGaussianKernelFunction.h"
#include "itkGaussianOperator.txx"
#include "itkGaussianSpatialFunction.txx"
#include "itkGreenPixelAccessor.h"
#include "itkHexahedronCell.txx"
#include "itkHexahedronCellTopology.h"
#include "itkIdentityTransform.h"
#include "itkImage.txx"
#include "itkImageAdaptor.txx"
#include "itkImageBase.txx"
#include "itkImageBoundaryCondition.h"
#include "itkImageConstIterator.txx"
#include "itkImageConstIteratorWithIndex.txx"
#include "itkImageContainerInterface.h"
#include "itkImageFunction.txx"
#include "itkImageIterator.txx"
#include "itkImageIteratorWithIndex.txx"
#include "itkImageLinearConstIteratorWithIndex.txx"
#include "itkImageLinearIteratorWithIndex.txx"
#include "itkImageRandomConstIteratorWithIndex.txx"
#include "itkImageRandomIteratorWithIndex.txx"
#include "itkImageRegion.txx"
#include "itkImageRegionConstIterator.txx"
#include "itkImageRegionConstIteratorWithIndex.txx"
#include "itkImageRegionExclusionConstIteratorWithIndex.txx"
#include "itkImageRegionExclusionIteratorWithIndex.txx"
#include "itkImageRegionIterator.txx"
#include "itkImageRegionIteratorWithIndex.txx"
#include "itkImageRegionMultidimensionalSplitter.txx"
#include "itkImageRegionReverseConstIterator.txx"
#include "itkImageRegionReverseIterator.txx"
#include "itkImageRegionSplitter.txx"
#include "itkImageReverseConstIterator.txx"
#include "itkImageReverseIterator.txx"
#include "itkImageSliceConstIteratorWithIndex.txx"
#include "itkImageSliceIteratorWithIndex.txx"
#include "itkImageSource.txx"
#include "itkImageToImageFilter.txx"
#include "itkImageToImageFilterDetail.h"
#include "itkImportImageContainer.txx"
#include "itkInPlaceImageFilter.txx"
#include "itkIndent.h"
#include "itkIndex.h"
#include "itkIndexedContainerInterface.h"
#include "itkIntTypes.h"
#include "itkInteriorExteriorSpatialFunction.txx"
#include "itkInterpolateImageFunction.h"
#include "itkIterationReporter.h"
#include "itkKLMSegmentationBorder.h"
#include "itkKLMSegmentationRegion.h"
#include "itkKernelFunction.h"
#include "itkKernelTransform.txx"
#include "itkLaplacianOperator.txx"
#include "itkLevelSet.h"
#include "itkLevelSetFunction.txx"
#include "itkLevelSetFunctionBase.txx"
#include "itkLightObject.h"
#include "itkLightProcessObject.h"
#include "itkLineCell.txx"
#include "itkLinearInterpolateImageFunction.txx"
#include "itkLog10ImageAdaptor.h"
#include "itkLogImageAdaptor.h"
#include "itkMacro.h"
#include "itkMapContainer.txx"
#include "itkMatrix.txx"
#include "itkMaximumDecisionRule.h"
#include "itkMaximumRatioDecisionRule.h"
#include "itkMeanImageFunction.txx"
#include "itkMedianImageFunction.txx"
#include "itkMesh.txx"
#include "itkMeshRegion.h"
#include "itkMeshSource.txx"
#include "itkMeshToMeshFilter.txx"
#include "itkMetaDataDictionary.h"
#include "itkMetaDataObject.txx"
#include "itkMetaDataObjectBase.h"
#include "itkMinimumDecisionRule.h"
#include "itkMultiThreader.h"
#include "itkMutexLock.h"
#include "itkMutexLockHolder.h"
#include "itkNearestNeighborInterpolateImageFunction.h"
#include "itkNeighborhood.txx"
#include "itkNeighborhoodAlgorithm.txx"
#include "itkNeighborhoodAllocator.h"
#include "itkNeighborhoodBinaryThresholdImageFunction.txx"
#include "itkNeighborhoodInnerProduct.txx"
#include "itkNeighborhoodIterator.txx"
#include "itkNeighborhoodOperator.txx"
#include "itkNeighborhoodOperatorImageFunction.txx"
#include "itkNthElementImageAdaptor.h"
#include "itkNthElementPixelAccessor.h"
#include "itkNumericTraits.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkObjectFactoryBase.h"
#include "itkObjectStore.txx"
#include "itkOctree.txx"
#include "itkOctreeNode.h"
#include "itkOffset.h"
#include "itkOneWayEquivalencyTable.h"
#include "itkOutputWindow.h"
#include "itkParametricPath.txx"
#include "itkPath.h"
#include "itkPathConstIterator.txx"
#include "itkPathFunctions.h"
#include "itkPathIterator.txx"
#include "itkPeriodicBoundaryCondition.txx"
#include "itkPixelAccessor.h"
#include "itkPixelTraits.h"
#include "itkPoint.txx"
#include "itkPointLocator.txx"
#include "itkPointSet.txx"
#include "itkPolyLineParametricPath.txx"
#include "itkPolygonCell.txx"
#include "itkProcessObject.h"
#include "itkProgressAccumulator.h"
#include "itkProgressReporter.h"
#include "itkQuadraticEdgeCell.txx"
#include "itkQuadraticTriangleCell.txx"
#include "itkQuadraticTriangleCellTopology.h"
#include "itkQuadrilateralCell.txx"
#include "itkQuadrilateralCellTopology.h"
#include "itkQuaternionRigidTransform.txx"
#include "itkRGBAPixel.txx"
#include "itkRGBPixel.txx"
#include "itkRGBToVectorImageAdaptor.h"
#include "itkRGBToVectorPixelAccessor.h"
#include "itkRedPixelAccessor.h"
#include "itkRegion.h"
#include "itkRigid2DTransform.txx"
#include "itkRigid3DPerspectiveTransform.txx"
#include "itkRigid3DTransform.txx"
#include "itkSTLConstContainerAdaptor.h"
#include "itkSTLContainerAdaptor.h"
#include "itkScalarToRGBPixelFunctor.txx"
#include "itkScalarVector.h"
#include "itkScaleLogarithmicTransform.txx"
#include "itkScaleTransform.txx"
#include "itkSegmentationBorder.h"
#include "itkSegmentationLevelSetFunction.txx"
#include "itkSegmentationRegion.h"
#include "itkShapedNeighborhoodIterator.txx"
#include "itkSimilarity2DTransform.txx"
#include "itkSimpleFastMutexLock.h"
#include "itkSinImageAdaptor.h"
#include "itkSize.h"
#include "itkSliceIterator.h"
#include "itkSmartPointer.h"
#include "itkSmartPointerForwardReference.txx"
#include "itkSobelOperator.txx"
#include "itkSpatialFunction.txx"
#include "itkSphereSpatialFunction.txx"
#include "itkSqrtImageAdaptor.h"
#include "itkSymmetricEllipsoidInteriorExteriorSpatialFunction.txx"
#include "itkTanImageAdaptor.h"
#include "itkTetrahedronCell.txx"
#include "itkTetrahedronCellTopology.h"
#include "itkTextOutput.h"
#include "itkThinPlateR2LogRSplineKernelTransform.txx"
#include "itkThinPlateSplineKernelTransform.txx"
#include "itkTimeProbe.h"
#include "itkTimeProbesCollectorBase.h"
#include "itkTimeStamp.h"
#include "itkTorusInteriorExteriorSpatialFunction.txx"
#include "itkTransform.txx"
#include "itkTranslationTransform.txx"
#include "itkTriangleCell.txx"
#include "itkTriangleCellTopology.h"
#include "itkValarrayImageContainer.h"
#include "itkVarianceImageFunction.txx"
#include "itkVector.txx"
#include "itkVectorContainer.txx"
#include "itkVectorInterpolateImageFunction.h"
#include "itkVectorLinearInterpolateImageFunction.txx"
#include "itkVectorNeighborhoodInnerProduct.txx"
#include "itkVectorToRGBImageAdaptor.h"
#include "itkVectorToRGBPixelAccessor.h"
#include "itkVersion.h"
#include "itkVersor.txx"
#include "itkVersorRigid3DTransform.txx"
#include "itkVersorTransform.txx"
#include "itkVertexCell.txx"
#include "itkVolumeSplineKernelTransform.txx"
#include "itkWeakPointer.h"
#include "itkXMLFileOutputWindow.h"
#include "itkZeroFluxNeumannBoundaryCondition.txx"
#include "itk_alloc.h"
#include "itk_hash_map.h"
#include "itk_hash_set.h"
#include "itk_hashtable.h"
#include "vcl_alloc.h"

int main ( int , char*  )
{

  return 0;
}

<|endoftext|>