Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to save indices of column in timeseries2matrix function #335

Closed
prateeksasan1 opened this issue Dec 7, 2020 · 2 comments
Closed

How to save indices of column in timeseries2matrix function #335

prateeksasan1 opened this issue Dec 7, 2020 · 2 comments

Comments

@prateeksasan1
Copy link

Hi,

I am trying to convert a 4-d image to a matrix using a mask using timeseries2matrix. I am also interested in noting what part of the mask corresponds to what column. Is it possible?

For e.g 4-d image is of dimension 90100801200 (1200 is the time point)
and i have a 3-d binary mask (dim = 90
100*80) with sum(mask) = 150

The output of timeseries2matrix would be a matrix of size 1200 * 150.

I want to know which indices of the mask the columns correspond to. i.e 1st column is mask index (1, 4, 5) , 2nd is (1, 4, 6) etc.

Is there an easy way to do this. I see in your code that you subset the image which makes it a vector and then turn it into a matrix but couldnt figure out how to get the indices

@stnava
Copy link
Member

stnava commented Dec 7, 2020 via email

@prateeksasan1
Copy link
Author

Thanks. I was not aware of this function.

Using getNeighborhoodInMask with spatial.info = TRUE, the 2nd matrix in the list gave me the indices. Awesome. Thanks a lot

Prateek Sasan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants