Skip to content

Commit

Permalink
sync code with internal version
Browse files Browse the repository at this point in the history
	- extended coil compression tool cc as replacement for scc
	   - geometric coil compression and
	   - preliminary version of ESPIRiT-based compression
	- spow (point-wise power) and cpyphs (copy phase) tools
	- resize tool can process multiple dimensions at once
	- fix missing lib directory for github version
	- other minor fixes and extensions
  • Loading branch information
uecker committed Oct 30, 2014
1 parent 8d3a48a commit 5d477a2
Show file tree
Hide file tree
Showing 40 changed files with 789 additions and 272 deletions.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ ismrm.top := /usr/local/ismrmrd/
# Main build targets

TBASE=slice crop resize join transpose zeros ones flip circshift extract repmat bitmask
TFLP=scale conj fmac saxpy sdot conv
TNUM=fft fftmod noise bench threshold creal
TFLP=scale conj fmac saxpy sdot spow cpyphs creal
TNUM=fft fftmod noise bench threshold conv
TRECO=sense pocsense rsense bpsense itsense nlinv nufft rof nusense
TCALIB=ecalib caldir walsh
TMRI=rss homodyne pattern scc poisson twixread
TCALIB=ecalib caldir walsh cc
TMRI=rss homodyne pattern poisson twixread
TSIM=phantom traj
TARGETS = $(TBASE) $(TFLP) $(TNUM) $(TRECO) $(TCALIB) $(TMRI) $(TSIM) $(TIO)

Expand All @@ -120,6 +120,7 @@ MODULES_itsense = -liter -llinops
MODULES_ecalib = -lcalib
MODULES_caldir = -lcalib
MODULES_walsh = -lcalib
MODULES_cc = -lcalib
MODULES_nufft = -lnoncart -liter -llinops
MODULES_rof = -liter -llinops
MODULES_bench = -lwavelet2 -llinops
Expand Down
22 changes: 17 additions & 5 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ saxpy scale <input1> <input2> <output>
Multiply input1 with scale factor and add input2.


spow exponent <input> <output>

Raise array to the power of {exponent}. The exponent can be a complex number.


fmac [-A] [-C] [-s bitmask] <input1> <input2> <output>

Multiply and accumulate.
Expand All @@ -292,6 +297,11 @@ conj <input> <output>
Compute complex conjugate.


cpyphs <input> <output

Copy phase from <input> to <output>.


fft [-u] [-i] bitmask <input> <output>

Performs a fast Fourier transform (FFT) along dimensions
Expand Down Expand Up @@ -380,14 +390,14 @@ ecaltwo [-c crop] [-m maps] x y z <input> <sensitivities> [<ev_maps>]
-m maps Number of maps to compute.


scc [-v] [-A] [-r cal_size] [-P num_coeffs] <kspace> <coeff>|<proj_kspace>
cc [-A] [-r cal_size] [-P num_coeffs] <kspace> <coeff>|<proj_kspace>

Performs simple coil compression.

-P N perform compression to N virtual channels
-r S size of calibration region
-A use all data to compute coefficients
-v verbose
-S|G|E type: SVD, Geometric, ESPIRiT
-h help


Expand Down Expand Up @@ -419,7 +429,7 @@ nusense [-l1/-l2] [-r lambda] <traj> <kspace> <sensitivities> <output>
-r lambda regularization parameter


bpsense [-g] [-r l2lambda] [-c] [-e eps] [-u rho] <kspace> <sensitivities> <output>
bpsense [-r l2lambda] [-c] [-e eps] [-u rho] <kspace> <sensitivities> <output>

Perform basis pursuit denoising for SENSE/ESPIRiT reconstruction:
min_x ||T x||_1 + lambda/2 ||x||_2^2 subject to: ||y - Ax||_2 <= eps
Expand All @@ -429,7 +439,7 @@ bpsense [-g] [-r l2lambda] [-c] [-e eps] [-u rho] <kspace> <sensitivities> <outp
-u rho ADMM penalty parameter
-c real-value constraint
-t use TV norm
-F truth image
-T truth image


nlinv [-i iterations] <kspace> <output> [<sens>]
Expand Down Expand Up @@ -479,7 +489,7 @@ rof lambda bitmask <input> <output>

poisson <outfile>

Computes Poisson-disc sampling pattern.
Computes Poisson-disc sampling pattern.

-X size dimension 0 (readout)
-Y size dimension 1 (phase)
Expand Down Expand Up @@ -526,6 +536,8 @@ twixread [...] [-a A] <dat file> <output>
-s S number of slices
-c C number of channels
-a A total number of ADCs
-L use linectr offset
-P use partctr offset
-h help


Expand Down
24 changes: 16 additions & 8 deletions src/bpsense.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

static void usage(const char* name, FILE* fd)
{
fprintf(fd, "Usage: %s [-g] [-r l2lambda] [-c] [-e eps] [-u rho] <kspace> <sensitivities> <output>\n", name);
fprintf(fd, "Usage: %s [-r l2lambda] [-c] [-e eps] [-u rho] <kspace> <sensitivities> <output>\n", name);
}

static void help(void)
Expand All @@ -57,7 +57,7 @@ static void help(void)
"-u rho\tADMM penalty parameter\n"
"-c\treal-value constraint\n"
"-t\tuse TV norm\n"
"-F\ttruth image\n");
"-T\ttruth image\n");
}


Expand All @@ -75,18 +75,20 @@ int main(int argc, char* argv[])

bool usegpu = false;
const char* psf = NULL;
char image_truth_fname[100];
_Bool im_truth = false;
_Bool use_tvnorm = false;
const char* image_truth_fname = NULL;
bool im_truth = false;
bool use_tvnorm = false;

double start_time = timestamp();

int c;
while (-1 != (c = getopt(argc, argv, "F:r:e:i:u:p:tcgh"))) {
while (-1 != (c = getopt(argc, argv, "T:r:e:i:u:p:tcgh"))) {
switch(c) {
case 'F':

case 'T':
im_truth = true;
sprintf(image_truth_fname, "%s", optarg);
image_truth_fname = strdup(optarg);
assert(NULL != image_truth_fname);
break;

case 'r':
Expand Down Expand Up @@ -292,6 +294,12 @@ int main(int argc, char* argv[])
unmap_cfl(N, ksp_dims, kspace_data);
unmap_cfl(N, img_dims, image);

if (im_truth) {

free((void*)image_truth_fname);
unmap_cfl(DIMS, img_dims, image_truth);
}

double end_time = timestamp();
debug_printf(DP_INFO, "Total Time: %f\n", end_time - start_time);

Expand Down
12 changes: 6 additions & 6 deletions src/caldir.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ int main_caldir(int argc, char* argv[])
{
mini_cmdline(argc, argv, 3, usage_str, help_str);

long dims[KSPACE_DIMS];
long dims[DIMS];

complex float* in_data = load_cfl(argv[2], KSPACE_DIMS, dims);
complex float* in_data = load_cfl(argv[2], DIMS, dims);

int calsize_ro = atoi(argv[1]);
long calsize[3] = { calsize_ro, calsize_ro, calsize_ro };

assert((dims[0] == 1) || (calsize_ro < dims[0]));
assert(1 == dims[4]);

complex float* out_data = create_cfl(argv[3], KSPACE_DIMS, dims);
complex float* out_data = create_cfl(argv[3], DIMS, dims);


long caldims[KSPACE_DIMS];
long caldims[DIMS];
complex float* cal_data = extract_calib(caldims, calsize, dims, in_data, false);

printf("Calibration region %ldx%ldx%ld\n", caldims[0], caldims[1], caldims[2]);
Expand All @@ -60,8 +60,8 @@ int main_caldir(int argc, char* argv[])

md_free(cal_data);

unmap_cfl(KSPACE_DIMS, dims, (void*)out_data);
unmap_cfl(KSPACE_DIMS, dims, (void*)in_data);
unmap_cfl(DIMS, dims, (void*)out_data);
unmap_cfl(DIMS, dims, (void*)in_data);

exit(0);
}
Expand Down
4 changes: 4 additions & 0 deletions src/calib/calib.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ static void eigen_herm3(int M, int N, float val[M], complex float matrix[N][N])



/*
* rotate phase jointly along dim so that the 0-th slice along dim has phase = 0
*
*/
void fixphase(unsigned int N, const long dims[N], unsigned int dim, complex float* out, const complex float* in)
{
assert(dim < N);
Expand Down
Loading

0 comments on commit 5d477a2

Please sign in to comment.