Questions tagged [mri]

Matz's Ruby Interpreter or Ruby MRI (also called CRuby) is the reference implementation of the Ruby programming language named after Ruby creator Yukihiro Matsumoto ("Matz"). Until the specification of the Ruby language in 2011, the MRI implementation was considered the de facto reference.

103 questions
3
votes
1 answer

Does the Ruby interpreter compile to byte-code in a lazy way? How?

For MRI 1.9+ and Rubinius implementation, Ruby source code is compiled into byte-code, and then that byte-code is interpreted by the VM. I want to know the details of this mechanism when running a Ruby script from command-line using the…
lucianolev
  • 519
  • 5
  • 5
2
votes
1 answer

How to compile ruby in debug mode?

There are plenty of ruby debug log calls in the source code that help me better understand internals. How do you debug ruby vm? Do you have a documentation for that? I haven't found any information in the GitHub documentation. What I tried but…
slip
  • 63
  • 6
2
votes
1 answer

Get bias field using sitk

I'm trying to use sitk library to clear biased Mr image (MRI). I'm able to get the corrected image but can't get the bias image. Set the following parameters: shrink_factor=1, mask_image=mask, number_of_iterations=100,…
Ohads
  • 63
  • 1
  • 1
  • 6
2
votes
1 answer

How Puma allows IO waiting to be done in parallel to improve MRI's throughput?

From Puma's README: On MRI, there is a Global VM Lock (GVL) that ensures only one thread can run Ruby code at a time. But if you're doing a lot of blocking IO (such as HTTP calls to external APIs like Twitter), Puma still improves MRI's throughput…
Weihang Jian
  • 7,826
  • 4
  • 44
  • 55
2
votes
1 answer

In Ruby, why `while true do i += 1 end` is not thread safe?

According to this post, i += 1 is thread safe in MRI Ruby because the preemption only happens at the end of function call, not somewhere between i += 1. A repeatable test below shows that this is true: But why while true do i += 1 end is not…
2
votes
1 answer

Is assignment an atomic operation in ruby MRI?

Let's say I have these two methods in my class. def set_val(val) @val = val end def get_val @val end I'll spawn multiple threads to call set_val with different values. Is it guaranteed that reading from @val returns the correct value, i.e.,…
2
votes
1 answer

What's the most official documentation of or way to learn Ruby's syntax?

There's https://ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/syntax.html, by Yukihiro Matsumoto himself, but given that I can't find mention of &. (e.g. a&.b) or &: (e.g. m(&:f)), it doesn't seem very updated. I remember once upon a time there…
JoL
  • 1,017
  • 10
  • 15
2
votes
0 answers

matlab's imshow3d mouse scrolling image visualization in python

Currently, I am trying to build a User Interface with python to visualize MRI images (in numpy) in 'tkinter' Graphic User Interface. The feature of mouse scrolling from Matlab's imshow3d is essential but I was not able to find anything like this on…
2
votes
2 answers

MRI and YARV Ruby implementations - what happened in Ruby 1.9?

As I understand it, prior to Ruby 1.9, MRI and YARV were two separate implementations of the Ruby programming language. What exactly changed in Ruby version 1.9? Was MRI abandoned in favour of YARV? Or were the two codebases merged in some way? I…
user200783
  • 13,722
  • 12
  • 69
  • 135
2
votes
0 answers

MRI duplicates memory allocation when Thread.new

It seems that MRI makes duplication of memory allocation for every new thread. I use Ubuntu x64, ruby-2.2.4 (rvm), and this what i get: Just started irb: I see pmap -d 1656 59760K (allocated memory, or '[ stack ]' for the program stack [man…
atlascoder
  • 2,746
  • 3
  • 26
  • 34
2
votes
0 answers

Does memoizing an instance of a class in a class method cause a memory leak in Ruby?

My colleagues and I are in the midst of hunting down a memory leak in our Ruby on Rails application and we have some initial indicators that code resembling the following may be the culprit: module Foo class Bar def self.example @widgets…
doremi
  • 14,921
  • 30
  • 93
  • 148
2
votes
1 answer

Finding the coordinates (mm) of identical slice locations for two MR datasets acquired in the same scanning session

I have two MR acquisitions where the first one is a 3D acquisition (1x1x1 mm3) and the second is a 2D acquisition (2.24 x 2.24 x 5.00 mm, axial slices). The high resolution dataset is a full head 3D acquisition that gives 176 slices if resliced in…
1
vote
2 answers

Un-gzipping MRI Files in MATLAB

I'm learning MATLAB +SPM12 to do structural MRI analysis. To do this, I need to change the format of the files from gz to NIFTI. The guide I'm using said to use gunzip('*.gz') Flanker=gunzip('*.gz') Dot indexing is not supported for variables of…
1
vote
0 answers

Collect clinical information from the ADNI

Hi scientists! I need to collect a number of PET-MR images from the ADNI website. I need to measure the SUVR values (Standardized Uptake Value) and compare two groups. My problem is I cannot find the height and weight of the subjects, and I need…
1
vote
1 answer

what is the meaning for each coordinate in ( mri_image.shape ) using nibabel library?

I am checking the shape of the MRI data that I downloaded from the ADNI website. it supposes to be a 3D image but this code produces 4 coordinates! I need to know what each coordinate here means. print(img.shape) the output that I got is (170, 256,…
eso
  • 11
  • 1