/usr/include/astrometry/kdtree_fits_io.h is in astrometry.net 0.46-0ubuntu2.
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 | /*
This file is part of libkd.
Copyright 2006-2008 Dustin Lang and Keir Mierle.
libkd 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, version 2.
libkd 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 libkd; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KDTREE_FITS_IO_H
#define KDTREE_FITS_IO_H
#include <stdio.h>
#include "kdtree.h"
#include "fitsbin.h"
#include "anqfits.h"
/**
Usage patterns:
kdtree_fits_t* io = kdtree_fits_open("in.kd.fits");
kdtree_t* kd = kdtree_fits_read_tree(io, "mytree");
// kd contains the tree that was read.
// io->fb->primheader is the primary header
fitsbin_chunk_t chunk;
chunk.tablename = "my_extra_data";
chunk.itemsize = sizeof(int32_t);
chunk.nrows = kd->ndata;
kdtree_fits_read_chunk(io, &chunk);
// chunk->header
// chunk->data
kdtree_fits_close();
kdtree_fits_t* io = kdtree_fits_open_for_writing("out.kd.fits");
kdtree_t* mytree = ...;
kdtree_fits_write_tree(io, mytree);
fitsbin_chunk_t chunk;
chunk.tablename = "my_extra";
chunk.data = ...;
chunk.itemsize = sizeof(int32_t);
chunk.nrows = mytree->ndata;
kdtree_fits_write_chunk(io, &chunk)
kdtree_fits_close();
*/
typedef fitsbin_t kdtree_fits_t;
kdtree_fits_t* kdtree_fits_open(const char* fn);
kdtree_fits_t* kdtree_fits_open_fits(anqfits_t* fits);
// convenience...
kdtree_t* kdtree_fits_read(const char* fn, const char* treename,
qfits_header** p_hdr);
int kdtree_fits_write(const kdtree_t* kdtree, const char* fn,
const qfits_header* hdr);
//sl* kdtree_fits_list_trees(kdtree_fits_t* io);
int kdtree_fits_contains_tree(const kdtree_fits_t* io, const char* treename);
fitsbin_t* kdtree_fits_get_fitsbin(kdtree_fits_t* io);
kdtree_t* kdtree_fits_read_tree(kdtree_fits_t* io, const char* treename,
qfits_header** p_hdr);
int kdtree_fits_read_chunk(kdtree_fits_t* io, fitsbin_chunk_t* chunk);
qfits_header* kdtree_fits_get_primary_header(kdtree_fits_t* io);
kdtree_fits_t* kdtree_fits_open_for_writing(const char* fn);
// writes the primary header and the tree.
int kdtree_fits_write_tree(kdtree_fits_t* io, const kdtree_t* kd,
const qfits_header* add_headers);
// just writes the tree, no primary header.
int kdtree_fits_append_tree(kdtree_fits_t* io, const kdtree_t* kd,
const qfits_header* add_headers);
int kdtree_fits_append_tree_to(kdtree_t* kd,
const qfits_header* inhdr,
FILE* fid);
int kdtree_fits_write_primary_header(kdtree_fits_t* io,
const qfits_header* add_headers);
int kdtree_fits_write_chunk(kdtree_fits_t* io, fitsbin_chunk_t* chunk);
int kdtree_fits_write_chunk_to(fitsbin_chunk_t* chunk, FILE* fid);
int kdtree_fits_close(kdtree_t* io);
int kdtree_fits_io_close(kdtree_fits_t* io);
// flipped-endian writing...
int kdtree_fits_write_chunk_flipped(kdtree_fits_t* io, fitsbin_chunk_t* chunk,
int wordsize);
int kdtree_fits_write_flipped(const kdtree_t* kdtree, const char* fn,
const qfits_header* hdr);
int kdtree_fits_write_tree_flipped(kdtree_fits_t* io, const kdtree_t* kd,
const qfits_header* inhdr);
int kdtree_fits_append_tree_flipped(kdtree_fits_t* io, const kdtree_t* kd,
const qfits_header* inhdr);
// names (actually prefixes) of FITS tables.
#define KD_STR_HEADER "kdtree_header"
#define KD_STR_NODES "kdtree_nodes"
#define KD_STR_LR "kdtree_lr"
#define KD_STR_PERM "kdtree_perm"
#define KD_STR_BB "kdtree_bb"
#define KD_STR_SPLIT "kdtree_split"
#define KD_STR_SPLITDIM "kdtree_splitdim"
#define KD_STR_DATA "kdtree_data"
#define KD_STR_RANGE "kdtree_range"
// is the given column name one of the above strings?
int kdtree_fits_column_is_kdtree(char* columnname);
#endif
|