[med-svn] [bart] 06/14: changed lrdecom to lrmatrix. added matrix completion ability

Martin Uecker uecker-guest at moszumanska.debian.org
Sun Dec 6 23:10:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

uecker-guest pushed a commit to annotated tag v0.2.09d
in repository bart.

commit 5e9bf804ad71c884c3a6645f900600b83f581421
Author: Frank Ong <frankong at berkeley.edu>
Date:   Tue Dec 1 22:18:20 2015 -0800

    changed lrdecom to lrmatrix. added matrix completion ability
---
 Makefile                      |  4 ++--
 src/{lrdecom.c => lrmatrix.c} | 28 ++++++++++++++++++++++++----
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 34f6ee5..9ba314c 100644
--- a/Makefile
+++ b/Makefile
@@ -109,7 +109,7 @@ ismrm.top ?= /usr/local/ismrmrd/
 TBASE=show slice crop resize join transpose zeros ones flip circshift extract repmat bitmask reshape version
 TFLP=scale conj fmac saxpy sdot spow cpyphs creal normalize cdf97 relnorm pattern nrmse
 TNUM=fft fftmod fftshift noise bench threshold conv rss filter
-TRECO=pics pocsense rsense bpsense itsense nlinv nufft rof sake wave lrdecom
+TRECO=pics pocsense rsense bpsense itsense nlinv nufft rof sake wave lrmatrix
 TCALIB=ecalib ecaltwo caldir walsh cc calmat svd estvar
 TMRI=homodyne poisson twixread fakeksp
 TSIM=phantom traj
@@ -149,7 +149,7 @@ MODULES_sake += -lsake
 MODULES_wave += -liter -lwavelet2 -llinops -lsense
 MODULES_threshold += -llowrank -llinops -lwavelet2 -liter -ldfwavelet
 MODULES_fakeksp += -lsense -llinops
-MODULES_lrdecom = -llowrank -liter -llinops
+MODULES_lrmatrix = -llowrank -liter -llinops
 
 -include Makefile.$(NNAME)
 -include Makefile.local
diff --git a/src/lrdecom.c b/src/lrmatrix.c
similarity index 88%
rename from src/lrdecom.c
rename to src/lrmatrix.c
index ab00589..d928252 100644
--- a/src/lrdecom.c
+++ b/src/lrmatrix.c
@@ -30,6 +30,7 @@
 
 #include "lowrank/lrthresh.h"
 #include "linops/sum.h"
+#include "linops/sampling.h"
 #include "iter/prox.h"
 #include "linops/someops.h"
 
@@ -69,21 +70,22 @@ static void usage(const char* name, FILE* fd)
 static void help(void)
 {
 	printf( "\n"
-		"Perform multi-scale low rank decomposition.\n"
+		"Perform (multi-scale) low rank matrix completion\n"
+                "-d\t\tperform decomposition instead, ie fully sampled\n"
                 "-i\t\tmaximum iterations.\n"
                 "-m\t\tflags to specify which dimensions are reshaped to matrix columns.\n"
                 "-f\t\tflags to specify which dimensions to perform multi-scale partition.\n"
                 "-j scale\tblock size scaling from one scale to the next one.\n"
                 "-k block-size\tsmallest block size\n"
                 "-N\t\tadd noise scale to account for Gaussian noise.\n"
-                "-s\t\tperform low rank + sparse decomposition.\n"
+                "-s\t\tperform low rank + sparse matrix completion.\n"
                 "-l block-size\tperform locally low rank soft thresholding with specified block size.\n"
                 "-o <output2>\tsummed over all non-noise scales to create a denoised output.\n"
 		"\n");
 }
 
 
-int main_lrdecom(int argc, char* argv[])
+int main_lrmatrix(int argc, char* argv[])
 {
 	double start_time = timestamp();
 
@@ -97,6 +99,7 @@ int main_lrdecom(int argc, char* argv[])
 	unsigned long flags = ~0;
 	const char* sum_str = NULL;
 	_Bool noise = false;
+        _Bool decom = false;
 
 	_Bool llr = false;
 	long llrblk = 8;
@@ -107,8 +110,11 @@ int main_lrdecom(int argc, char* argv[])
 	int remove_mean = 0;
 
 	int c;
-	while (-1 != (c = getopt(argc, argv, "uvNi:p:m:j:k:o:hnl:sf:gHF"))) {
+	while (-1 != (c = getopt(argc, argv, "uvNi:p:m:j:k:o:hnl:sf:gHFd"))) {
 		switch(c) {
+
+                case 'd':
+                        decom = true;
                         
 		case 'u':
                         remove_mean = 1;
@@ -216,6 +222,13 @@ int main_lrdecom(int argc, char* argv[])
 	complex float* odata = create_cfl(argv[optind + 1], DIMS, odims);
 	md_clear( DIMS, odims, odata, sizeof(complex float) );
 
+	// Get pattern
+	complex float* pattern = NULL;
+
+        if (!decom) {
+                pattern = md_alloc(DIMS, idims, CFL_SIZE);
+                estimate_pattern(DIMS, idims, TIME_DIM, pattern, idata);
+        }
 
 	// Initialize algorithm
 	void* iconf;
@@ -233,6 +246,13 @@ int main_lrdecom(int argc, char* argv[])
 	// Initialize operators
 
 	const struct linop_s* sum_op = sum_create( odims, use_gpu );
+	const struct linop_s* sampling_op = NULL;
+        if (!decom) {
+                sampling_op = sampling_create(idims, idims, pattern);
+                sum_op = linop_chain(sum_op, sampling_op);
+                linop_free(sampling_op);
+        }
+	
 	const struct operator_p_s* sum_prox = prox_lineq_create( sum_op, idata );
 	const struct operator_p_s* lr_prox = lrthresh_create(odims, randshift, mflags, (const long (*)[])blkdims, 1., noise, remove_mean, use_gpu);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/bart.git



More information about the debian-med-commit mailing list