Monday, April 09, 2007

Inter-observer, Intra-observer, observer bias variability

Those terms are commonly used in image processing e.g. comparing reproductivity of given segmentation method. Their meaning is as fallow:

Inter-observer - one observer scores the same phenomena several times at different times. For example: few times the same radiologist selects region of interest (ROI) on the same X-ray. The question is, how similar those selections separated in time are to each other i.e. can the radiologists manually select exactly the same ROI in terms of position, shape, size?

Intra-observer - few observers score the same phenomena. For instance: few radiologists select manually ROI on the same X-ray. What is the agreement in selected ROI by different radiologists.

Observer bias - each observer can interpret the same phenomena differently. For example, if selecting ROI, radiologist can include into ROI distorted parts of an X-ray image (e.g. by noise), because for him those distortions are small. At the same time, the other radiologists can avoid those parts of X-ray, cause for him those distortions are to serious to ignore.

Sunday, March 25, 2007

Matlab and huge matrix execution time

Recently I was working with huge, really huge 3D matrixes in Matlab for example take matrix A=ones(64,64,50100). It is huge matrix of double values. Unfortunately operations on such a matrix are very time consuming.

For example performing summation of all values along the third dimension sum(A,3)
takes 235 seconds on Ultra Sparc Sun-Fire-440. That is why sometimes it maybe beneficial to create single or unsigned integer 32bit (uint32) matrix instead of doubles e.g: A=uint32(ones(64,64,50100)). In this case performing sum over third dimension takes 211 seconds. When using single instead of double, the time is 204 sec. The difference is not so big, however when using uint8 the time is only 60s. Unfortunately using uint8 when one wants to sum up matrix with over 50000 numbers has no sense unless it is heavily sparse matrix - uint8 holds numbers not bigger than 256.

In conclusion, I think it is better to avoid such matrixes.

Wednesday, March 21, 2007

Directional evaluation of fractal dimension using Power Spectrum Method

Power spectrum algorithm, based on J. Russ book [1] divided 2D power spectrum of an imput image into 'slices' which represent directions and frequencies as show below:
For example one can divide power spectrum i to 24 radial slices i.e. one slice is 15 degrees (24*15=360) and slice is divided to 30 frequencies (30 rings). The greater radius of the ring, the bigger frequency.
Apart from directional fractal dimension evaluation, algorithm performs overall fractal dimension analysis by 'averaging by circles'. In this case power spectrum is divided to 60 (2*30) rings:

In addition, vertical and horizontal direction are not considered in the computation as to avoid border effects.

[1]John C. Russ, Fractal Surfaces, 1994

Sunday, February 11, 2007

SPSS+Python: First script

The below scripts reads Excel file. Than the python program pairs variables, that will be compared using paired t-test.
GET DATA
/TYPE=XLS
/FILE='/Users/marcin/Desktop/myPublicationDataAnalysis_newAniso/fs_Lud_byMarcin10/VOT/Sta_fs.xls'
/SHEET=name 'Lat'
/CELLRANGE=full
/READNAMES=off
/ASSUMEDSTRWIDTH=32767.

DATASET NAME DataSet1 WINDOW=FRONT.

BEGIN PROGRAM.
import spss
from spss import Submit

ScalesC=['V'+str(i+1) for i in range(1,10)]
ScalesOA=['V'+str(i+11) for i in range(1,10)]

for v in zip(ScalesC,ScalesOA):
c= "T-TEST PAIRS="+v[0]+" WITH "+v[1]+" (PAIRED) /CRITERIA=CI(.9500) /MISSING=ANALYSIS."
Submit(c)
END PROGRAM.

Friday, February 09, 2007

Samsung Digimax S500 and Sony Cyper-shot 6.0

Rubbish!!!Rubbish!!!!
Another Korean junk that I have bought. I will never again buy anything that comes from Korea. Before I had problems with DVD player from LG, and now, after taking only few pictures
with Samsung digital camera it stop working.
Now when I want to take a picture, camera just switches off, and that's it. Sometimes I can make one picture, but second one is not possible. This happens only when flash is used, so I reckon that flash lite causes some electric overload, and camera switches off.

Why today only junk is created? And it is not only Korean. My friend bought Sony Cyber-shot 6.0M and after one month it was broken. The lens was stacked in its shield.


Sony is from Japan, Samsung and LG (my former post about LG DNX-190 UH DVD player) are from Korea, so what they have in common? They are made in China.

Wednesday, January 31, 2007

Windows XP overwrites linux boot menu

This happened to me today, when I installed new Windows XP on a PC with pre-installed Ubuntu. Fortunately, fast I used Super Grub Disk witch can easily repair what Windows XP destroyed. Restroing former boot menu, was just a matter of few seconds.

Wednesday, January 17, 2007

Interesting USB drive

Yesterday, I got nice present from my girfriend - a USB key. It is quite interesting model,
because it was given for free as a promotion for a chewing gum :-). This USB drive looks like
box of gum; hence, at first I thought that I was given a gum. I was quite surprise to find
USB storage instead gum. This USB drive, is quite small as for today standards ( only 64MB),
but is something. For example I can use it to carry DSL (Damn Small Linux) distribution. For
now I'm planing to use it normally, because it is nice and many people are surprise when
I show it to them.


Monday, January 15, 2007

Ruby: bash image processing

As working mainly with images and image processing, sometimes I have to do one or two simple operations on many files at once like resizing, converting RGB two Gray, changing format of images, mirroring, blurring, etc. To this time I was always using Matlab to do it, because I could not find any free software on Mac X that can do such simple operations. Nonetheless, there are some issues with Matlab that annoy me, specifically: there is no native Matlab for Intel Mac X 10.4. Matlab works on Mac X 10.4 only by emulation mode, which is extremely slow and most importantly crashes very often. I had to find some more reliable solution, and I find it in Ruby.

Ruby, has very good image processing package called RMagick (interface between the Ruby programming language and the ImageMagick and GraphicsMagick image processing libraries). Installation is quite trivial. Explanation how to install RMagick on Mac X is here. I fallowed those instructions and had no problem.

#!/opt/local/bin/ruby
#convertFiles.rb
require 'rubygems'
require 'RMagick'

class ConvertFiles

def initialize inDir='inputDir/', outDir='out/'
raise 'No INPUT dir' if !File.exist? inDir
@inDir = inDir
@outDir = outDir
@files = Array.new
readFiles
createOutDir
end

def readFiles
Dir.glob(@inDir+'*.tiff').each { |l|
@files.push File.basename(l)
}
end

def createOutDir
Dir.mkdir(@outDir) if !File.exist? @outDir
end

def singleImgProcess img
return img.scale!(0.50)
end

def bashProcess
@files.each { |fn|
puts @inDir+fn
img=Magick::Image.read(@inDir+fn).first
img = singleImgProcess img
img.write(@outDir+fn)
}
end

end


Example usage is also quite simple:

c = ConvertFiles.new
c.bashProcess
Moreover, if I need some other operation or operations, I can just create new class, inheriting from the above one e.g.:


class Enlarge < ConvertFiles
def singleImgProcess img
return img.scale!(1.50)
end
end

e = Enlarge.new
e.bashProcess


Or if I want to add some text to all images, I just can do:

class AddText < ConvertFiles

def setText t
@txt = t
end

def singleImgProcess img
@txt='Default' if @txt.nil?
text = Magick::Draw.new
text.annotate(img, 0, 0, 0, 60, @txt) {
self.gravity = Magick::SouthGravity
self.pointsize = 48
}
return img
end
end


a=AddText.new
a.setText 'My pictures'
a.bashProcess

This simple code, shows how powerful and convenient Ruby can be.

Sunday, January 14, 2007

DVD player: LG DNX-190 UH

I have just bought DVD Player - LG DNX-190 UH:
Unfortunately, to make it work was quite a big problem. My TV has only S-Video socket for video input, so I thought that when I connect my new DVD and TV using S-Video cable, it would work without any problems. Of course, it did not. There was no picture! I had sound working, but I did not see anything. Studying a manual, I discoverd that in order to use S-Video connection, you have to go to Setup menu in DVD, and change it there. This is just great!!!. How can I manipulate Setup options if I do not have any picture?!!!. Impressed by this genius solution from Korean engineers I get quite angry. Of course before that, I had gotten angry, because my dvd box did not include S-Video cable, but fortunately, I had my own.

The only thing I could do, was to take this rubbish dvd player, go to my friend, connect it using Video cable, change the S-Video option in Setup menu in his place, return home, and connect to my TV. After that I finally could see something on my DVD.

For now, I have not seen any movie, so I do not know if this dvd player can play movies correctly. I have just start one or two movies to see if they work. They worked. I have not had time to investigate how useful and convenient this dvd player is, and if he plays everything correctly.

One positive thing about it for now, is the fact that in shop I was given a sheet of paper witch 'cheats', how to make this dvd palyer multi-region. I have not tried it, so I cannot say if it works, and even if, I do not have any dvd movie from another dvd region.

UPDATE
Finally I had some time to look closer to this DVD. After few minutes, I decided to return this rubbish DVD player. This junk was playing DVDs with some 'cracks' in a picture which sometimes was 'jumping'. It was not very often, and as a matter of fact, you could watch movies, but those occasional 'jumps' were annoying. Not thinking much, I return this junk, and I had it replaced. Fortunately, the shop did not make any problems with exchange, just 'no question asked'.

Tuesday, January 09, 2007

Mac X: Making backup of your dvd movie

Sometimes people buy dvd movies, for AU$30-40 and of course they would like to make a copy of it, because it wouldn't be nice to destroy original disks.

Windows users don't have problems with that, because there exists great free tool to do it called DVD Shirnk. I used it to make backup of my collection of Star Wars movies, and it is really worth of recommending.

But what about Mac X users? At the moment I want to backup one freshly bought movie, and unfortunately on Mac X this task is not so trivial. First of all, there is no free tool (at least I could not find any) to do this. Of course there are many commercial software that can be helpful, but I do not what to spend money, on software that is used really rarely.

Therefore, what I do is, I use two tools to make backups. First, I use free MacTheRipper (A DVD extractor) to dump movie to hard drive. It must be noted, that MacTheRipper do not compress (shrink) movies; thus, if your move is bigger that 4.37GB, you have to use another tool, to shirk it, after it was copied to hard drive.

To shrink movie, you can use: Popcorn, DVD2OneX, DVDRemaster or Toast Titanium. Luckily for me, I owe the last program. Therefore, I can burn shirked movie to DVD5.

Nevertheless, this workaround solution is not as good as the one using DVD Shrink on Windows. First and foremost, you cannot choose what parts of DVD you want to extract like which languages, sound, subtitles, extra features etc. MacTheRipper gives you opportunity mainly to dump main movie only, all full dvd. You cannot select that you want e.g. English subtitles only or/and Polish ones.

But, for now I do not see any great alternative for me in the task of backuping dvd movies on Mac X.