Array2dFile (const char* const filename, unsigned int nx, unsigned int ny);
~Array2dFile ();
- virtual unsigned int getNumLabels (void) const
- { return num_labels; }
+ unsigned int getNumLabels (void) const
+ { return num_labels; }
bool labelRead (Array2dFileLabel& label, unsigned int label_num);
- bool labelAdd (const char* const label_str, double calc_time=0.);
+ void labelAdd (const Array2dFileLabel& label);
- bool labelAdd (int type, const char* const label_str, double calc_time=0.);
+ void labelAdd (const char* const label_str, double calc_time=0.);
+
+ void labelAdd (int type, const char* const label_str, double calc_time=0.);
void fileClose (void);
}
lseek (file_id, headersize, SEEK_SET);
- for (int ix = 0; ix < nx; ix++)
+ for (unsigned int ix = 0; ix < nx; ix++)
{
write (file_id, array->array_data[ix], ny * pixel_size);
}
template<class T>
-bool
+void
Array2dFile<T>::labelAdd (const char* const lstr, double calc_time=0.)
{
labelAdd (Array2dFileLabel::L_HISTORY, lstr, calc_time);
}
template<class T>
-bool
+void
Array2dFile<T>::labelAdd (int type, const char* const lstr, double calc_time=0.)
{
Array2dFileLabel label (type, lstr, calc_time);
+ labelAdd (label);
+}
+
+template<class T>
+void
+Array2dFile<T>::labelAdd (const Array2dFileLabel& label)
+{
labelSeek (num_labels);
write_nint16 (&label.label_type, file_id);
#endif
+#ifdef MPI_CT
+#include <mpi.h>
+#endif
class F32Image
{
public:
- Array2dFile<kfloat32> idf;
+ Array2dFile<kfloat32> adf;
- F32Image (const char* const fname, unsigned int nx, unsigned int ny) : idf (fname, nx, ny)
+ F32Image (const char* const fname, unsigned int nx, unsigned int ny) : adf (fname, nx, ny)
{
- idf.pixel_type = Array2dFile<kfloat32>::FLOAT32;
+ adf.pixel_type = Array2dFile<kfloat32>::FLOAT32;
}
- F32Image (unsigned int nx, unsigned int ny) : idf (nx, ny)
+ F32Image (unsigned int nx, unsigned int ny) : adf (nx, ny)
{
- idf.pixel_type = Array2dFile<kfloat32>::FLOAT32;
+ adf.pixel_type = Array2dFile<kfloat32>::FLOAT32;
}
- F32Image (const char* const fname) : idf (fname)
+ F32Image (const char* const fname) : adf (fname)
{
- idf.pixel_type = Array2dFile<kfloat32>::FLOAT32;
+ adf.pixel_type = Array2dFile<kfloat32>::FLOAT32;
}
+
+#ifdef MPI_CT
+ MPI_Datatype getMPIDataType (void) const
+ { return MPI_FLOAT; }
+#endif
};
class F64Image
{
public:
- Array2dFile<kfloat64> idf;
+ Array2dFile<kfloat64> adf;
+
+#ifdef MPI_CT
+ MPI_Datatype getMPIDataType (void) const
+ { return MPI_DOUBLE; }
+#endif
- F64Image (const char* const fname, unsigned int nx, unsigned int ny) : idf (fname, nx, ny)
+ F64Image (const char* const fname, unsigned int nx, unsigned int ny) : adf (fname, nx, ny)
{
- idf.pixel_type = Array2dFile<kfloat64>::FLOAT64;
+ adf.pixel_type = Array2dFile<kfloat64>::FLOAT64;
}
- F64Image (unsigned int nx, unsigned int ny) : idf (nx, ny)
+ F64Image (unsigned int nx, unsigned int ny) : adf (nx, ny)
{
- idf.pixel_type = Array2dFile<kfloat64>::FLOAT64;
+ adf.pixel_type = Array2dFile<kfloat64>::FLOAT64;
}
- F64Image (const char* const fname) : idf (fname)
+ F64Image (const char* const fname) : adf (fname)
{
- idf.pixel_type = Array2dFile<kfloat64>::FLOAT64;
+ adf.pixel_type = Array2dFile<kfloat64>::FLOAT64;
}
};
-typedef F64Image ImageFile;
+typedef F64Image ImageFile;
+typedef kfloat64 ImageFileValue;
+typedef kfloat64* ImageFileColumn;
+typedef kfloat64** ImageFileArray;
+
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ir.h,v 1.19 2000/06/07 00:59:38 kevin Exp $
+** $Id: ir.h,v 1.20 2000/06/07 02:30:27 kevin Exp $
** $Log: ir.h,v $
+** Revision 1.20 2000/06/07 02:30:27 kevin
+** Added C++ image files
+**
** Revision 1.19 2000/06/07 00:59:38 kevin
** added imagefiles
**
#ifndef IR_H
#define IR_H
-#ifdef MPI_CT
-#define MPI_MAX_PROCESS 128
-struct mpi_ct_st
-{
- int my_rank;
- int nproc;
- int base_local_work_units;
- int remainder_work_units;
- int local_work_units[MPI_MAX_PROCESS];
- int start_work_unit[MPI_MAX_PROCESS];
- MPI_Comm comm;
-};
-
-extern struct mpi_ct_st mpi_ct;
-void mpi_ct_calc_work_units(const unsigned int global_work_units);
-#endif
-
struct histo_st {
int *b; /* Histogram array (# of elements in each bin) */
extern "C" {
#endif /* __cplusplus */
-void usage (const char *program);
+#ifdef MPI_CT
+#define MPI_MAX_PROCESS 128
+struct mpi_ct_st
+{
+ int my_rank;
+ int nproc;
+ int base_local_work_units;
+ int remainder_work_units;
+ int local_work_units[MPI_MAX_PROCESS];
+ int start_work_unit[MPI_MAX_PROCESS];
+ MPI_Comm comm;
+};
+
+extern struct mpi_ct_st mpi_ct;
+void mpi_ct_calc_work_units(const unsigned int global_work_units);
+#endif
+
/* From reconstr.c */
IMAGE *image_reconst (IMAGE *im, RAYSUM *rs, const FilterType filt_type, double filt_param, InterpolationType interp_type, int interp_param, const BackprojType backproj_type, int const ir_trace);
int opt_set_trace(const char *optarg);
const char *name_of_phantom(const int phmid);
int opt_set_phantom(const char *optarg);
-int opt_set_interpolation(const char *optarg);
+InterpolationType opt_set_interpolation(const char *optarg);
const char *name_of_interpolation(int interp_type);
-int opt_set_filter(const char *optarg);
+FilterType opt_set_filter(const char *optarg);
const char *name_of_filter(const int filter);
DomainType opt_set_filter_domain(const char *optarg);
const char *name_of_filter_domain(const DomainType domain);
-int opt_set_backproj(const char *optarg);
+BackprojType opt_set_backproj(const char *optarg);
const char *name_of_backproj(const BackprojType backproj);
/* phm.c */