This file is indexed.

/usr/include/CiftiLib/Cifti/CiftiBrainModelsMap.h is in libcifti-dev 1.5.1-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#ifndef __CIFTI_BRAIN_MODELS_MAP_H__
#define __CIFTI_BRAIN_MODELS_MAP_H__

/*LICENSE_START*/ 
/*
 *  Copyright (c) 2014, Washington University School of Medicine
 *  All rights reserved.
 *
 *  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.
 */

#include "CiftiMappingType.h"

#include "Common/Compact3DLookup.h"
#include "StructureEnum.h"
#include "VolumeSpace.h"

#include <map>
#include <utility>
#include <vector>

namespace cifti
{
    class CiftiBrainModelsMap : public CiftiMappingType
    {
    public:
        enum ModelType
        {
            SURFACE,
            VOXELS
        };
        struct SurfaceMap
        {
            int64_t m_ciftiIndex;
            int64_t m_surfaceNode;
        };
        struct VolumeMap
        {
            int64_t m_ciftiIndex;
            int64_t m_ijk[3];
        };
        struct ModelInfo
        {
            ModelType m_type;
            StructureEnum::Enum m_structure;
            int64_t m_indexStart, m_indexCount;//these are intended only for summary info, use getSurfaceMap, etc for the index to vertex/voxel mappings
        };
        struct IndexInfo
        {
            ModelType m_type;
            StructureEnum::Enum m_structure;
            int64_t m_surfaceNode;//only one of these two will be valid
            int64_t m_ijk[3];
        };
        bool hasVolumeData() const;
        bool hasVolumeData(const StructureEnum::Enum& structure) const;
        bool hasSurfaceData(const StructureEnum::Enum& structure) const;
        int64_t getIndexForNode(const int64_t& node, const StructureEnum::Enum& structure) const;
        int64_t getIndexForVoxel(const int64_t* ijk, StructureEnum::Enum* structureOut = NULL) const;
        int64_t getIndexForVoxel(const int64_t& i, const int64_t& j, const int64_t& k, StructureEnum::Enum* structureOut = NULL) const;
        IndexInfo getInfoForIndex(const int64_t index) const;
        std::vector<SurfaceMap> getSurfaceMap(const StructureEnum::Enum& structure) const;
        std::vector<VolumeMap> getFullVolumeMap() const;
        std::vector<VolumeMap> getVolumeStructureMap(const StructureEnum::Enum& structure) const;
        const VolumeSpace& getVolumeSpace() const;
        int64_t getSurfaceNumberOfNodes(const StructureEnum::Enum& structure) const;
        std::vector<StructureEnum::Enum> getSurfaceStructureList() const;
        std::vector<StructureEnum::Enum> getVolumeStructureList() const;
        const std::vector<int64_t>& getNodeList(const StructureEnum::Enum& structure) const;//useful for copying mappings to a new dense mapping
        const std::vector<int64_t>& getVoxelList(const StructureEnum::Enum& structure) const;
        std::vector<ModelInfo> getModelInfo() const;
        
        CiftiBrainModelsMap() { m_haveVolumeSpace = false; m_ignoreVolSpace = false; }
        void addSurfaceModel(const int64_t& numberOfNodes, const StructureEnum::Enum& structure, const float* roi = NULL);
        void addSurfaceModel(const int64_t& numberOfNodes, const StructureEnum::Enum& structure, const std::vector<int64_t>& nodeList);
        void addVolumeModel(const StructureEnum::Enum& structure, const std::vector<int64_t>& ijkList);
        void setVolumeSpace(const VolumeSpace& space);
        void clear();
        
        CiftiMappingType* clone() const { return new CiftiBrainModelsMap(*this); }
        MappingType getType() const { return BRAIN_MODELS; }
        int64_t getLength() const;
        bool operator==(const CiftiMappingType& rhs) const;
        bool approximateMatch(const CiftiMappingType& rhs, AString* explanation = NULL) const;
        void readXML1(XmlReader& xml);
        void readXML2(XmlReader& xml);
        void writeXML1(XmlWriter& xml) const;
        void writeXML2(XmlWriter& xml) const;
    private:
        struct BrainModelPriv
        {
            ModelType m_type;
            StructureEnum::Enum m_brainStructure;
            int64_t m_surfaceNumberOfNodes;
            std::vector<int64_t> m_nodeIndices;
            std::vector<int64_t> m_voxelIndicesIJK;
            
            int64_t m_modelStart, m_modelEnd;//stuff only needed for optimization - models are kept in sorted order by their index ranges
            std::vector<int64_t> m_nodeToIndexLookup;
            bool operator==(const BrainModelPriv& rhs) const;
            bool operator!=(const BrainModelPriv& rhs) const { return !((*this) == rhs); }
            void setupSurface(const int64_t& start);
        };
        VolumeSpace m_volSpace;
        bool m_haveVolumeSpace, m_ignoreVolSpace;//second is needed for parsing cifti-1
        std::vector<BrainModelPriv> m_modelsInfo;
        std::map<StructureEnum::Enum, int> m_surfUsed, m_volUsed;
        Compact3DLookup<std::pair<int64_t, StructureEnum::Enum> > m_voxelToIndexLookup;//make one unified lookup rather than separate lookups per volume structure
        int64_t getNextStart() const;
        struct ParseHelperModel
        {//specifically to allow the parsed elements to be sorted before using addSurfaceModel/addVolumeModel
            ModelType m_type;
            StructureEnum::Enum m_brainStructure;
            int64_t m_surfaceNumberOfNodes;
            std::vector<int64_t> m_nodeIndices;
            std::vector<int64_t> m_voxelIndicesIJK;
            int64_t m_offset, m_count;
            bool operator<(const ParseHelperModel& rhs) const
            {
                if (m_offset < rhs.m_offset) return true;
                if (m_offset > rhs.m_offset) return false;//get the common cases first
                if (m_count < rhs.m_count) return true;//in case we have a zero-length model - this shouldn't happen, usually
                return false;
            }
            void parseBrainModel1(XmlReader& xml);
            void parseBrainModel2(XmlReader& xml);
            static std::vector<int64_t> readIndexArray(XmlReader& xml);
        };
    };
}

#endif //__CIFTI_BRAIN_MODELS_MAP_H__