Update of Lin4Neuro (28 Dec 2013)

Lin4Neuro was updated. Some changes are…

  • Kernel was updated to 3.5.0-44-generic.
  • FSL was updated to 5.0.6.
  • Ginkgo CADx was updated to 3.6.0.
  • MINC toolkit was updated to 1.0.01
  • MITK was updated to 2013.12.00.
  • Slicer was updated to 4.3.1.
  • LibreOffice was updated to 4.1.4.2

You can download the latest Lin4Neuro from here.

Now I’m focusing on the 64bit version of Lin4Neuro, so I suspend updating 32bit version. One of the task is to make the UEFI-compatible L4N. I hope it will be possible to boot from UEFI on the next update.

JBL Flip on Xubuntu 12.04

Xubuntu 12.04からJBL FlipをBluetoothで接続しようとしたところ、すぐにはつながりませんでした。
ググったところ、このサイトが参考になりました。

pulseaudio-module-bluetoothがキモでした。

sudo apt-get install pulseaudio-module-bluetooth

これでPulseaudioの設定で音がきちんと出るようになりました。

Thinkpad T430sでUbuntu 12.04ファミリーがフリーズする時

Thinkpad T430sにXubuntu 12.04を入れました。インストール自体は何の問題もなかったのですが、入れてから1日の間に10回以上システムがフリーズしました。マウスもキーボードも何の操作も受け付けなくなってしまうのです。

これでは、信頼できないマシンになってしまいます…。

いろいろ調べたところ、カーネルを3.4にアップデートしたところ、問題が解決したという記事をみつけました。

実際にやってみました。

  1. http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.4-precise/にアクセスします。
  2. 64bitの場合ここから3つのファイルをダウンロードします。
    • linux-headers-3.4.0-030400-generic_3.4.0-030400.201205210521_amd64.deb
    • linux-headers-3.4.0-030400_3.4.0-030400.201205210521_all.deb
    • linux-image-3.4.0-030400-generic_3.4.0-030400.201205210521_amd64.deb

    つまり、後ろにamd64.debとあるものとall.debとあるものです。32bitの場合でしたらi386.debとall.debになります。

  3. ダウンロードしたあとで、次のコマンドでカーネルをインストールします。
    sudo dpkg -i linux-*
    
  4. カーネルがインストールされたあと、古いカーネルを削除します。そのためには、apt-get autoremoveがよいと思います。
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get autoremove
    
  5. マシンを再起動します。
  6. ターミナルを立ち上げ、次のようにタイプします。
    uname -r
    

    これで3.4.0-030400-genericと表示されれば新しいカーネルになったことを確認できます。

こうしたところ、私のThinkpad T430sは全くフリーズしなくなりました。カーネルの問題だったということですね。これで安心して解析ができます。

Ubuntuのキーボードセッティング

Ubuntuではキーボードのレイアウトを簡単に変えることはできますが、「システムデフォルト」はコマンドラインでしか変えられないようです。

keyboard

変えたい時は以下をタイプすれば大丈夫です。

sudo dpkg-reconfigure keyboard-configuration

ちなみに、私はThinkapd 430sの英語キーボードを使っているので、Generic 101に変更しました。

TeX Live 2012 on Ubuntu 12.04

Windows 8.1を試しに使ってみたら、あまりにも不適応を起こしたので、この際、思い切ってメイン環境をLinuxに切り替えることにしました。

OSはXubuntu 12.04ベースのLin4Neuroです。自分が使いやすいようにカスタマイズしているので、一番自分にぴったりあっています。
Latexに関しては、TeX Live 2012を入れたいと思っていたのですが、検索したら、こちらのサイトに非常にわかりやすく解説されていました。やるべきことは下記のとおりです。

sudo apt-add-repository ppa:texlive-backports/ppa
sudo apt-get update; sudo apt-get upgrade; sudo apt-get install texlive-lang-cjk

こんなに簡単にできるのは感動ものです。

Ubuntu 12.04でLibreOfficeを3.xから4.xにアップグレードする方法

Ubuntu 12.04LTSを利用していると、LibreOfiiceは3.xのままです。
しかし、LibreOfficeは4.xにアップグレードされ、互換性なども高まっているようです。
以下の方法で、簡単にLibreOfficeを3.xから4.xにアップグレードできます。

sudo add-apt-repository ppa:libreoffice/ppa
sudo apt-get update
sudo apt-get dist-upgrade

ここでポイントは、apt-get updateの後にapt-get dist-upgradeを行うことです。

apt-get upgradeとapt-get dist-upgradeの違いは、man apt-getに以下の記載があります。

upgrade
upgrade は、現在システムにインストールされている全パッケージの最新バージョンを、/etc/apt/sources.list に列挙した取得元からインストールするのに使用します。現在インストール中のパッケージに新しいバージョンがあれば更新しますが、いかなる時も現在インストール中のパッケージの削除は行いません。対象のパッケージが、他のパッケージのインストール状態を変更せずに更新できない場合は、現在のバージョンのままとなります。最初に update を実行しておき、apt-get にパッケージの新しいバージョンがあることを知らせる必要があります。

dist-upgrade
dist-upgrade は、upgrade の機能に加え、新バージョンのパッケージに対する依存関係の変更を知的に操作します。apt-get は「洗練された」競合解決システムを持ち、必要とあらば比較的重要でないパッケージを犠牲にして、最重要パッケージの更新を試みます。そのため dist-upgradeは、いくつかのパッケージを削除する可能性があります。/etc/apt/sources.list ファイルには、必要なパッケージファイルを検索する場所のリストが含まれています。

upgradeは全く削除されることなく、dist-upgradeは必要あらばファイルを削除する可能性があるわけですね。今回、LibreOfficeの3.xから4.xへのアップグレードには、いくつかのファイルが削除される必要もあるので、dist-upgradeを利用することとなります。

何はともあれ、この3つのコマンドで、LibreOfficeを3.xから4.xにアップグレードできます。

Script to change images to 300dpi TIFF format

When we prepare research paper, many journals require the resolution of images to be 300dpi.
Below is the script to change various image files to 300dpi TIFF format.

#!/bin/bash
#A script which converts various image file formats into 300 dpi TIFF format.
#Usage: dpi300tiff.sh filename
#Wild card can be used.</code>

if [ $# = 0 ]
then
  echo "Please specify the files you want to convert!"
  echo "Usage: dpi300tiff.sh filename"
  exit 1
fi

for image in "$@"
do
  if [ -f $image ]
  then
  convert -units PixelsPerInch $image -density 300 `echo $image | sed 's/\..*$/.tiff/'`
else
  echo "$image: No such file"
fi
done

ubuntuのホスト名の変更

Ubuntuでホスト名を変えたい場合、以下の2つのファイルを変更します。

  • /etc/hostname
  • ホスト名だけ記載されているのでそれを変えます。

  • /etc/hosts
  • ここでは、127.0.0.1の後にホスト名が記載されているのでそれを変えます。

備忘録として。

Update of Lin4Neuro (28 Feb 2013)

Lin4Neuro was updated. Some changes are…

  • 3D Slicer was updated to 4.2.2-1 (only in 64bit version).
  • MITK and MITK Diffusion was updated to 2012.12 version (only in 64bit version).
  • nfs-common was added so that it can support NFS filesystem with default settings.

I also stopped developing Lin4Neuro based on Ubuntu 10.04LTS. I focus on developing Lin4Neuro based on Xubuntu 12.04LTS.

You can download latest Lin4Neuro from here.

Xubuntuで用紙サイズがLetterになってしまうとき…

Xubuntuでいろいろ印刷するときに、用紙をA4と設定しても、プリンターの方で、「Letterになっています。強制印刷しますか?」のような警告が出ることがいつもでした。
原因は何だろうと思っていたら、次の変数でした。

/etc/environment
の中にLC_PAPERというものがあります。

これが、私の場合、

LC_PAPER="en_US.UTF-8"

となっていました。調べたところ、この設定だと用紙サイズのデフォルトは、Letterになること。
なので、これを

LC_PAPER="ja_JP.UTF-8"

と変えたところ、問題がなくなりました。
locale設定が用紙サイズにも影響しているんですね。
Xubuntuだけでなく、Ubuntuでも同じようなことが起こるのだと思います。

A study of shell script: Convert various image files formats into EPS format

I’m learning shell scripts these days.
Below is a script which converts various image file formats (jpg, png, etc…) into eps format using ImageMagick.
LaTeX user might find this script useful.

#!/bin/sh
#A script which converts various image file formats into EPS format.
#Usage: image2eps.sh filename
#Wild card can be used.

if [ $# = 0 ]
then
echo "Please specify the files you want to convert!"
echo "Usage: image2eps.sh filename"
exit 1
fi

for image in "$@"
do
if [ -f $image ]
then
convert $image `echo eps2:$image | sed 's/\..*$/.eps/'`
else
echo "$image: No such file"
fi
done

Shell color of Xubuntu

I noticed that Xubuntu overrides color of shell.
I looked for the solution and found the colorcode is in ~/.config/Terminal/terminalrc

[Configuration]
ColorForeground=#000000000000
ColorBackground=#ffffffffffff
ColorCursor=#000000000000
ColorSelection=#e3d6e3d6e3d6
ColorSelectionUseDefault=FALSE
ColorPalette2=#66660a3d0a3d
ColorPalette3=#000066661999
ColorPalette4=#4ecf2e2e6666
ColorPalette5=#171734344d4d
ColorPalette6=#800012d38000
ColorPalette7=#000080008000
ColorPalette8=#35357878b3b3
ColorPalette9=#999999999999
ColorPalette10=#80000ccd0ccd
ColorPalette11=#0000a6662999
ColorPalette12=#9d9d5c5ccccc
ColorPalette13=#262656568080
ColorPalette14=#cccc1e6dcccc
ColorPalette15=#0000aaaaaaaa
ColorPalette16=#52529393cccc
FontName=Droid Sans Mono 10
MiscAlwaysShowTabs=FALSE
MiscBell=FALSE
MiscBordersDefault=TRUE
MiscCursorBlinks=FALSE
MiscCursorShape=TERMINAL_CURSOR_SHAPE_BLOCK
MiscDefaultGeometry=80x24
MiscInheritGeometry=FALSE
MiscMenubarDefault=TRUE
MiscMouseAutohide=FALSE
MiscToolbarsDefault=FALSE
MiscConfirmClose=TRUE
MiscCycleTabs=TRUE
MiscTabCloseButtons=TRUE
MiscTabCloseMiddleClick=TRUE
MiscTabPosition=GTK_POS_TOP
MiscHighlightUrls=TRUE
TabActivityColor=#262656568080

By commenting out the items regarding Color, I got the traditional look of shell.

shell

FSLのMacOSへのインストール方法(FSL 6.0.5以前)

*これは相当古いインストラクションです。新たなインストラクションを別に準備しますので、FSL 6.0.6 以降のインストール方法はそちらをご参照ください。

Mac OSXにFSLをインストールする機会がありました。
いくつか工夫が必要だったので、メモします。

(9/Dec/2014: fslinstaller.pyはスーパーユーザーでなくても大丈夫と気づいたので、修正しました。また、Yosemiteの場合についても追記しました。)
(1/Mar/2014: .bash_profileがない場合の対処を追記しました。また、改行コードについての注意も記載しました)

続きを読む

New Lin4Neuro based on Xubuntu 12.04

I am pleased to announce the new release of Lin4Neuro based on Xubuntu 12.04LTS.
Only 64-bit version is released this time, but I’m working on 32-bit version so hopefully I will be able to release the 32-bit version in the near future.

I chose Xubuntu 12.04 as a base of Lin4Neuro simply because I don’t like Unity. If you look at the screenshot of new Lin4Neuro, you can tell that I made UI as simple as I could.

At the same time, I keep working on Lin4Neuro based on Ubuntu 10.04LTS, because FSLView doesn’t work on Ubuntu 12.04… I know some of users like to use FSLView, so I keep working on it.

Other than FSLView, there are some differences between versions.

  • New Lin4Neuro (L4N12.04) includes DSI studio in response to a request by Renaud Nicolas.
  • L4N12.04 doesn’t includ N3 tools. I haven’t been able to install the software yet.

So Now you have three options. From now on I will name the each version as following (I do not change the file name of old versions);

You can download each version from http://www.nemotos.net/lin4neuro/

Hope Lin4Neuro will help you enjoy playing with your images.

The location of config file of Menu and Panel of Xubuntu

In the process of remastering customized Xubuntu, I spent lots of time to identify the location of config file of Menu and Panel of Xubuntu. Usually files should be located to /etc/skel, but xfce seems to have different policies.

The menu settings is stored in

~/.config/menus/xfce-applications.menu

and the panel settings is stored in

~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml

And the system-wide settings are stored in the locations below.

/etc/xdg/xdg-xubuntu/menus/xfce-applications.menu (menu)
/etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml (panel)
/etc/xdg/xfce4/panel/* (panel)

You also need to copy some files in home directory to /etc/skel.

So if you want to reflect your personal customization in system-wide setting, you need to type the following from the terminal.

sudo cp ~/.config/menus/xfce-applications.menu /etc/xdg/xdg-xubuntu/menus/
sudo cp ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml \
  /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/
sudo cp -r ~/.config/xfce4/panel /etc/xdg/xfce4/
sudo cp -a .config .gconf .gnome2 .local .bashrc /etc/skel
sudo cp -a ./Desktop /etc/skel/
cd /etc/skel
sudo chown -R root:root .config .gconf .gnome2 .local .bashrc Desktop

Linuxでのファイル・ディレクトリ名一括置換

ときどきファイル名やディレクトリ名を一括で置換したいことがあります。

私の場合、こんなことがありました。

あるデータがこんなディレクトリに入ってきました。

120903
120904
120910

120929

しかし、私の管理方法では、

20120903
20120904
20120910

20120929

としたいわけです。

端末から簡単に打てるコマンドがないかと探したところ、

その名も rename というコマンドがありました。

rename 's/検索文字列/置換文字列/' ファイル・ディレクトリ名(ワイルドカード可)

となるようです。

私の場合

$ rename 's/^12/2012/' *

で目的を達成することができました。
備忘録として残しておきます。

Lin4Neuro日本語版ページの開設

これまで需要がありましたが、多忙にかまけてさぼっていたLin4Neuroの日本語版のページを作成いたしました。英語が苦手な方やとりあえず、何がどうなってるのと思う方々には多少お役に立てるのではないかと思います。
このブログの上の方にある「Lin4Neuro日本語版」をクリックしていただくか、
こちらからご覧ください。