Skip to content

Commit

Permalink
Merge pull request #27 from sfarrens/mr1d
Browse files Browse the repository at this point in the history
mr1d
  • Loading branch information
sfarrens authored Jul 8, 2019
2 parents 11044ce + 484256a commit d4d218b
Show file tree
Hide file tree
Showing 15 changed files with 5,494 additions and 17 deletions.
20 changes: 5 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,24 @@ addons:
- cmake
- pkgconfig
- cfitsio
update: true

matrix:
include:
- os: linux
- os: osx
name: "macOS with GCC"
osx_image: xcode10.1
osx_image: xcode10.2
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
addons:
homebrew:
packages:
- gcc@7
- *macos_packages
- os: osx
name: "macOS with vanilla Clang"
osx_image: xcode10.1
env:
- MATRIX_EVAL="CC=/usr/local/opt/llvm/bin/clang && CXX=/usr/local/opt/llvm/bin/clang++"
addons:
homebrew:
packages:
- llvm
- libomp
- *macos_packages
- os: osx
name: "macOS with AppleClang"
osx_image: xcode10.1
osx_image: xcode10.2
addons:
homebrew:
packages:
Expand All @@ -53,12 +43,12 @@ before_install:
install:
- mkdir build
- cd build
- cmake ..
- cmake .. -DRUN_TESTS=OFF

# build package and install
script:
- make install
- make test
# - make test

# notification settings
notification:
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ project(sparse2d)
endif()
message(STATUS "Installing to: ${CMAKE_INSTALL_PREFIX}")

# Find OpenMP
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
set(OpenMP_INCLUDE_PATH "/usr/local/include")
set(OpenMP_LIB_PATH "/usr/local/lib")
Expand Down Expand Up @@ -144,7 +143,9 @@ ${FFTW_FLAGS}"

# Compile and link executables
set(BINMR2D mr_transform mr_recons mr_filter mr_deconv mr_info cur_contrast
cur_deconv cur_filter cur_stat cur_trans)
cur_deconv cur_filter cur_stat cur_trans im1d_convert im1d_info im1d_stf
im1d_tfreq mr1d_detect mr1d_trans im1d_der_loggamma im1d_period im1d_tend
mr1d_filter)
if(SPARSE3D)
set(BINMR2D ${BINMR2D} mr3d_trans mr3d_filter mr3d_recons mr3d_stat
mr2d1d_trans)
Expand Down
123 changes: 123 additions & 0 deletions src/im1d_convert.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/******************************************************************************
** Copyright (C) 1998 by CEA
*******************************************************************************
**
** UNIT
**
** Version: 1.0
**
** Author: Jean-Luc Starck
**
** Date: 21/09/98
**
** File: im1d_convert.cc
**
*******************************************************************************
**
** DESCRIPTION
** -----------
**
**
**
******************************************************************************/


#include "Array.h"
#include "IM_Obj.h"
#include "IM1D_IO.h"

char Name_Imag_In[256];
char Name_Imag_Out[256];

extern int OptInd;
extern char *OptArg;

extern int GetOpt(int argc, char *const*argv, char *opts);

int NSkip=0;

/****************************************************************************/

static void usage(char *argv[])
{

fprintf(stdout, "Usage: %s options image output\n\n", argv[0]);
fprintf(stdout, " FITS format (.fits) \n");
fprintf(stdout, " ACII format (.dat) \n");
fprintf(stdout, " EXEL format (.csv) \n");

fprintf(stdout, " where options = \n");

fprintf(stdout, " [-s line_number_to_skip]\n");
fprintf(stdout, " Skip the s first lines of the input file.\n");

fprintf(stdout, "\n");

exit(-1);
}

/*********************************************************************/

/* GET COMMAND LINE ARGUMENTS */

static void transinit(int argc, char *argv[])
{
int c;

/* get options */
while ((c = GetOpt(argc,argv,"s:")) != -1)
{
switch (c)
{
case 's':
if (sscanf(OptArg,"%d",&NSkip) != 1)
{
fprintf(stdout, "bad number of lines: %s\n", OptArg);
usage(argv);
}
break;
case '?':
usage(argv);
}
}

/* get optional input file names from trailing
parameters and open files */
if (OptInd < argc) strcpy(Name_Imag_In, argv[OptInd++]);
else usage(argv);

if (OptInd < argc) strcpy(Name_Imag_Out, argv[OptInd++]);
else usage(argv);

/* make sure there are not too many parameters */
if (OptInd < argc)
{
fprintf(stdout, "Too many parameters: %s ...\n", argv[OptInd]);
usage(argv);
}
}


/****************************************************************************/


int main(int argc, char *argv[])
{
fltarray Dat;
fltarray Mallat;
/* Get command line arguments, open input file(s) if necessary */
transinit(argc, argv);

// Dat.fits_read(Name_Imag_In);
io_1d_read_data (Name_Imag_In, Dat, NSkip);
cout << endl << endl;

cerr << "CONVERT " << String1DFormat(io_detect_1dformat(Name_Imag_In));
cerr << " to " << String1DFormat(io_detect_1dformat(Name_Imag_Out)) << endl;

io_1d_set_format(Name_Imag_Out);
io_1d_write_data (Name_Imag_Out, Dat);

exit(0);
}

Loading

0 comments on commit d4d218b

Please sign in to comment.