Open artturuohola opened 4 years ago
Also I'm trying to understand what do some of your variables in your matlab scripts mean in script/gel/matlab
function [sfnr_value,sfnr_image] = signal_to_fluictuation_noise(use_mask, signal_img,temporal_fluctuation_noise_img,roi,soi )
function [signal_to_noise_ratio,signal_sum_val,variance_summary_value] = snr_summary_value( use_mask,static_spatial_noise_image,roi,soi,signal_img,remove_time_series,dim4 )
function [ rechteck_roi , bin_mask_phantom ] = calculate_roi(image,dim1,dim2,dim3,dim4,roi_length )
function [spike_array,spike_array_counter]= fast_fourier_analysis( use_mask,residuals,tr,dim4,remove_time_series,phantom_name,fft_probability_limit )
Hey, I am sorry for my late response.
It should be possible, with the version of Bhalerao Gaurav Vivek and Pravesh Parekh. Our phantom was a cylinder which covers the whole measurement volume. I think they both used as well an other phantom, which did not cover the whole measurement volume. For the sphere phantom you have to detect the middle slice so that you have coverd a big part of the phantom. @parekhpravesh can you help here?
SOI = Slice of interest: In the original paper of Friedman and Glover they used only one slice, so we did as well. We calculated the middle slice of measurement volume. We wanted to update to investigate more than one slice (e.g. 3-4 slices / a small volumen) but at the moment hadn't time to implement (sorry for that)
Remove time series: we know that a mr scanner needs a little time to have a stable signal. the scanner normaly makes some dummy scans which will be not safed. but our experiance shows that we need to remove the first 2-3 time points of the functional measurement. this is the value to define how many timepoints will be removed.
roi length: this defines how big the region of interest (roi) should be. in this roi all the parameter will be calculated (inside the phantom). this value represents how many voxel should be included. like 15x15 = 225 Voxel. this roi must cover the phantom. So for you its more important to hit the middle slice of your phantom.
fft probability limit is a value for settting the limit for probability limit the spike detection algorithm in the function.
I hope it helps and if you any questions feel free to ask.
Hello! Apologies for the late reply. Yes, indeed. It is possible to use a different kind of phantom with the provided scripts (albeit with a little bit of modification to some code).
The phantom that @gvbhalerao591 and I used was a ProAgar phantom which was similar to the cylindrical phantom that @vogelbac used. We modified the calculate_roi
script such that we detected the first and the last slice where only one connected component exists. To clarify, the issue here was that the ends of the phantom appeared tapering in the images and therefore the binary mask would not work too well. For each of the slice, we performed a connected components labeling of the image; any slice where more than one component existed was ignored (typically the first and last two slices). For the slices where we had one uniform component, we propagated the mask from the middle slice; this was to make sure that mask size remained consistent across slices. I suspect this would be needed for a spherical phantom too. We added the following before the line bin_mask_phantom = binary_mask;
:
% Calculate connected components for binary_mask
num_components = zeros(dim4,dim3);
for time = 1:dim4
for slices = 1:dim3
[~, num_components(time, slices)] = spm_bwlabel(binary_mask(:,:,slices,time));
end
end
% Find the first slice where uniformly one component exists
loc_begin = sum(num_components,1)==dim4;
loc_begin = find(loc_begin,1);
% Find the last slice where uniformly one component exists
loc_end = sum(num_components,1)==dim4;
loc_end = find(loc_end, 1, 'last');
% All slices where mask should be propagated (aggressive version)
% We are adding a couple of extra slices here to ignore as it helped us generalize the code
% your margin will differ based on your phantom
all_slices = [1:loc_begin+2 loc_end-2:dim3];
% For these slices, propagate the mask from middle slice
for slices = 1:length(all_slices)
binary_mask(:,:,all_slices(slices),:) = binary_mask(:,:,round(dim3/2),:);
end
slices_to_ignore = all_slices;
We additionally exported the slices_to_ignore
variable and passed it to psg
and psc
functions so that these problematic slices could be eliminated from calculations. For your data, I suspect this would be one of the key things to work around with because the slices will not be of the same size, unlike a cylindrical phantom.
The second critical thing is the placement of the ROIs outside the phantom. One of the challenges that we initially faced was that the phantom size was large and covered most of the field of view during acquisition; therefore, sometimes the automatic ROI detection would fail (as there would not be enough "space" on either side for the ROI to be placed). This was sometimes creating problem with ghosting_detection
. Our solution was to wrap the entire code in a while loop; every time there was a problem with ROI placement, we would reduce the size of the ROI by 1. This version is available in the current_working
branch.
Hope this helps in getting you started! If you face an issue, it would be great to share a example NIfTI file with us so that we could see what other special considerations might need to be coded for.
Here's an example of our agar gel phantom and the problem that I was mentioning above. The slices highlighted in yellow in panel c)
result in poor binary mask creation and interfere with processing. The code above can help us ignore these slices. The figure is from our paper (it is under proof reading right now and should be available soon); we also describe the modifications that we performed to the code to adapt it for our site:
Parekh, P., Bhalerao, G.V., Rao, R., Sreeraj, V.S., Holla, B., Saini, J., Venkatasubramanian, G., John, J.P., Jain, S., 2021. Protocol for Magnetic Resonance Imaging Acquisition, Quality Assurance, and Quality Check for the Accelerator Program for Discovery in Brain Disorders using Stem Cells. International Journal of Methods in Psychiatric Research. DOI: 10.1002/mpr.1871
I would like to use your tool to perform QA analysis on this phantom:
https://www.goldstandardphantoms.com/funstar
Is that possible?