Closed chiharusako closed 4 years ago
Hi @chiharusako, this issue shoud be fixed buy #1291. Could you please verify this? The artifacts are here: https://dev.azure.com/CBICA/CaPTk/_build/results?buildId=2321&view=artifacts&type=publishedArtifacts
I am compiling this on my home directory, as well and it should be available on ~patis/testing/captkMyFork_1.8.0.nonRelease.20200908.834dc79
@sarthakpati It still doesn't output an image. Also why do you need a t1ce input? Is it being used? If so, are there requirements for this, such as registered with perfusion etc?
dir=/cbica/home/sakoc/comp_space/lab/captk/180b/perfalign2
$ ~patis/testing/captkMyFork_1.8.0.nonRelease.20200908.834dc79/bin/PerfusionAlignment \
-i $dir/ACST_2019.08.29_perf.nii.gz \
-c $dir/ACST_2019.08.29_t1ce.nii.gz \
-b 15 -a 17 -t 2 -o $dir/output > $dir/output/log
$ ls $dir/output
interpolated_curve.csv original_curve.csv revised_curve.csv truncated_curve.csv
I think the T1Gd DICOM is required [ref] and not NIfTI.
That documentation is old. It no longer requires the 2. DSC dicom slice either. This is what -h gives now. Is it using t1ce it in the calculation?
$ ~patis/testing/captkMyFork_1.8.0.nonRelease.20200908.834dc79/bin/PerfusionAlignment -h
Executable Name: PerfusionAlignment v1.8.0.nonRelease.20200908.834dc79
Description:
Perfusion Alignment of the input based based on specified time points
Usage:
:::Required parameters:::
[ -i, --input] The input DSC-MRI image.
Expected Type :: STRING
Expected Range ::
[ -c, --t1ce file] The input T1 post-weighted image.
Expected Type :: STRING
Expected Range ::
[ -b, --timepoints before drop] The number of time-points before the drop.
Expected Type :: STRING
Expected Range ::
[ -a, --timepoints after drop] The number of time-points after the drop.
Expected Type :: STRING
Expected Range ::
[ -t, --timedomain resolution] The time-interval between two consecutive volumes in time-domain (in seconds).
Expected Type :: FLOAT
Expected Range ::
[ -o, --output] The output directory.
Expected Type :: STRING
Expected Range ::
You are right; I was mistaken. The documentation needs to be updated after the usage has been finalized (I have no idea whether T1Gd is required or not).
@chiharusako are you using the same input as you mentioned earlier? what time-resolution you are providing as input; this is different from echo time? time-resolution is generally 2sec for penn data having 45 time-points.
the code needs the following parameters as input:
like this: -i AAAC_PreOp_perf_pp.nii.gz -c AAAC_PreOp_t1ce_pp.nii.gz -b 15 -a 17 -t 2 -o
@saimarathore Is the 6. time-resolution the time resolution (TR) for the input or output? Also why do you need a t1ce input?
time-resolution is for the input perfusion image. it is actually the spacing in the 4th dimension, which is generally 2sec for perfusion images having 45 time-points.
we need t1ce to write the aligned perfusion volumes in the t1ce space.
I talked to @saimarathore Here is my updated feedback and results, understanding the updated usage and required input.
Updated feedback:
Updated Results: (the output nii.gz were written in current directory but I moved to the output folder)
$ dir=/cbica/home/sakoc/comp_space/lab/captk/180b/perfalign3
$ t=AAAA_2007.01.21
$ /cbica/home/patis/testing/captkMyFork_1.8.0.nonRelease.20200908.834dc79/bin/PerfusionAlignment \
-i input/${t}_perf_LPS_rSRI_SSFinal.nii.gz \
-c input/${t}_t1ce_LPS_rSRI_SSFinal.nii.gz \
-b 15 -a 17 \
-t 2 \
-o out_$t > out_$t/log
$ mv out_*nii.gz out_$t
$ ls out_$t
interpolated_curve.csv out_AAAA_2007.01.2120.nii.gz out_AAAA_2007.01.2127.nii.gz out_AAAA_2007.01.2134.nii.gz out_AAAA_2007.01.2141.nii.gz out_AAAA_2007.01.2148.nii.gz
log out_AAAA_2007.01.2121.nii.gz out_AAAA_2007.01.2128.nii.gz out_AAAA_2007.01.2135.nii.gz out_AAAA_2007.01.2142.nii.gz revised_curve.csv
original_curve.csv out_AAAA_2007.01.2122.nii.gz out_AAAA_2007.01.2129.nii.gz out_AAAA_2007.01.2136.nii.gz out_AAAA_2007.01.2143.nii.gz truncated_curve.csv
out_AAAA_2007.01.2116.nii.gz out_AAAA_2007.01.2123.nii.gz out_AAAA_2007.01.2130.nii.gz out_AAAA_2007.01.2137.nii.gz out_AAAA_2007.01.2144.nii.gz
out_AAAA_2007.01.2117.nii.gz out_AAAA_2007.01.2124.nii.gz out_AAAA_2007.01.2131.nii.gz out_AAAA_2007.01.2138.nii.gz out_AAAA_2007.01.2145.nii.gz
out_AAAA_2007.01.2118.nii.gz out_AAAA_2007.01.2125.nii.gz out_AAAA_2007.01.2132.nii.gz out_AAAA_2007.01.2139.nii.gz out_AAAA_2007.01.2146.nii.gz
out_AAAA_2007.01.2119.nii.gz out_AAAA_2007.01.2126.nii.gz out_AAAA_2007.01.2133.nii.gz out_AAAA_2007.01.2140.nii.gz out_AAAA_2007.01.2147.nii.gz
image of one of the outputs. The intensity is bright on the outside and very low inside brain
From our meeting today, there are 2 things that need to be addressed:
Is that right @saimarathore?
@sarthakpati Yes, and the 3 items I wrote before your comment..
Hey @chiharusako, I have made some changes. Could you please check on the cluster? It will be available in ~patis/testing/captkMyFork_1.8.0.nonRelease.20200916.596fd79
@sarthakpati It didn't finish. Did it work for you?
$ dir=/cbica/home/sakoc/comp_space/lab/captk/180b/perfalign4
$ /cbica/home/patis/testing/captkMyFork_1.8.0.nonRelease.20200916.596fd79/bin/PerfusionAlignment \
-i input/AAAA_2007.01.21_perf_LPS.nii.gz \
-b 15 -a 17 -t 2 \
-o out_AAAA_2007.01.21 > out_AAAA_2007.01.21/log
$ tail out_AAAA_2007.01.21/log
82 : 275
83 : 275
84 : 276
85 : 276
86 : 275
87 : 275
88 : 275
89 : 0
Curve characteristics after base normalization::: base = 299; drop = 35; min = 194; max = 300
Segmentation fault
Yeah, I tried with a few images and it worked fine. Can you email/message the path to the image?
/cbica/home/sakoc/comp_space/lab/captk/180b/perfalign4/input/AAAA_2007.01.21_perf_LPS.nii.gz or /cbica/home/sakoc/comp_space/lab/captk/180b/perfalign4/input/AAAA_2007.01.21_perf.nii.gz if you need the 4th dimension to be correct (2s)
Got it. I can replicate the seg-fault. I will debug and let you know.
So, this is happening because the total number of volumes in the perfusion image is 45, drop is detected at 35 but the pointsAfterDrop
parameter (-a
in CLI) is 17, which makes the vector go out of range. I have added a message to tackle this:
Drop has been estimated at '35' and total number of time-points are '45' but time-points after drop is given as '10', which is not possible.
Let me know if you want some other wording.
@sarthakpati The drop is not at 35 out of 45. Perhaps it's confusing the drop after resampling to 1 sec. For this example, the drop is around 17 out of 45 (curve below), 2sec interval. Once you resample to 1sec, it will have 90 timepoints and drop will be at around 35 but it should have enough timepoints after.
We can talk tomorrow if it helps.
Ah, now I understand this much better. Yes, it was trying to perform the extraction on the original perfusion, hence the error. I am testing a fix right now.
Update: https://github.com/CBICA/CaPTk/commit/e89823b3fd9145ae25b6b7ab6091538bafdcf11b seems to have fixed it. I am compiling on the cluster right now (and ready at ~patis/testing/captkMyFork_1.8.0.nonRelease.20200917.e89823b
).
After conversing with Hamed, the function NormalizeBaselineValue
needs to be re-written to ensure the baseline shift happens correctly.
Done.
Describe the bug PerfusionAlignment only outputs csv and not an image. Also, help documentation needs to be updated.
To Reproduce
Expected behavior Output an aligned perfusion image
CaPTk Version 1.8.0.Beta on cbica-cluster
Desktop (please complete the following information):
Additional context Documentation example says
However there is no -d option in the required parameters. Also, do we need the t1ce file and echo time? I gave it as parameters above as it won't run without it, but I am not sure if it is using it, especially if requiring the perfusion dicom as input.