Re: [ccp4bb] X-ray diffraction image --> .jpg

2009-10-22 Thread David Waterman
Hi Andy,

As well as the other alternatives, ADXV can output high resolution
graphics files (1:1 if you choose 100% scale) with colouring that
matches what you see in the Image window. Go to File -> Save for this
function. As you're working with ADSC images you might be used to
viewing with ADXV anyway (though it can view other formats too).

If you don't have the software away from your favourite beamline, you
can download it for various X-windows systems from
http://www.scripps.edu/~arvai/adxv.html.

Cheers
David



-Original Message-
From: CCP4 bulletin board [mailto:ccp...@jiscmail.ac.uk] On Behalf Of
Morten Kjeldgaard
Sent: 22 October 2009 10:33
To: CCP4BB@JISCMAIL.AC.UK
Subject: Re: [ccp4bb] X-ray diffraction image --> .jpg

On 21/10/2009, at 16.53, Andy Torelli wrote:
>   Is there a free utility that can convert an x-ray diffraction
image 
> collected with an ADSC detector to a standard image file format e.g. 
> .jpg, png, etc.?  I'm looking for something more elegant than a 
> screen-capture that will yield a higher (graphics) resolution image.
> I'm sure someone must have done this, but I haven't been able to find 
> one.

It's not free, but with Photoshop you can do anything you want with TIFF
based diffraction images. To be able to see anything, though, you need
to do "Image -> Adjustments -> Equalize", otherwise all you'll see is
black.

Cheers,
Morten

--
This e-mail and any attachments may contain confidential, copyright and or 
privileged material, and are for the use of the intended addressee only. If you 
are not the intended addressee or an authorised recipient of the addressee 
please notify us of receipt by returning the e-mail and do not use, copy, 
retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not 
necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments 
are free from viruses and we cannot accept liability for any damage which you 
may sustain as a result of software viruses which may be transmitted in or with 
the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and 
Wales with its registered office at Diamond House, Harwell Science and 
Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom



Re: [ccp4bb] X-ray diffraction image --> .jpg

2009-10-22 Thread Morten Kjeldgaard

On 21/10/2009, at 16.53, Andy Torelli wrote:
	Is there a free utility that can convert an x-ray diffraction image  
collected with an ADSC detector to a standard image file format  
e.g. .jpg, png, etc.?  I'm looking for something more elegant than a  
screen-capture that will yield a higher (graphics) resolution image.  
I'm sure someone must have done this, but I haven't been able to  
find one.


It's not free, but with Photoshop you can do anything you want with  
TIFF based diffraction images. To be able to see anything, though, you  
need to do "Image -> Adjustments -> Equalize", otherwise all you'll  
see is black.


Cheers,
Morten


Re: [ccp4bb] X-ray diffraction image --> .jpg

2009-10-21 Thread James Holton
Believe it or not, you can do this with ImageMagick, which is already 
part of most linux distros:


convert -depth 16 -type Grayscale -colorspace GRAY -endian LSB -size 
3072x3072+512 \

 GRAY:test_0_001.img test_0_001.jpg

where this example turns a binned Q315 image (3072x3072 pixels) with a 
512-byte header (almost always the case) that has 
"BYTE_ORDER=little_endian" into a jpg image.  For a big_endian image, 
you change LSB to HSB in the above command.


You may notice that the image above compresses incredibly well (about 
300 fold), but if you look at it, you will be very disappointed as it is 
almost totally black.  This is because JPEG only uses the high-order 
byte of a 16-bit image.  One could argue that this is perhaps the 
"right" way to look at diffraction patterns since the most important 
information is in the bright spots and not the noisy background, but if 
you want to render your *.img file in the "ADXV way", then this command 
is close:


convert -depth 16 -type Grayscale -colorspace GRAY -endian LSB -size 
3072x3072+512 \
 GRAY:test_0_001.img -negate -crop 1024x1024+512+512 -equalize 
test_0_001.jpg


The "-negate" flag will make the spots black and the background grey, 
and the "-equalize" filter will throw out all the "outlier pixels" 
(spots) so you can look at the background.  You may also want to use the 
"-crop" option to focus in on just one part of the image.  There are 
other "enhancement" flags like -normalize, and -contrast-stretch or 
-brightness and -contrast, but the exact behavior of these flags will 
depend on the version of ImageMagick you have.


There is probably also a way to "colorize" the data the way ADXV does 
with the "heat" or "rainbow" options, but I don't know how to do that in 
ImageMagick.  In such cases, I do use screen capture, but again 
ImageMagick's "import" program is convenient for this.  Coupled with the 
-autoload flag in ADXV, you can set the environment variable 
$XFORMSTATUSFILE to something like ./temp.txt and write a script to echo 
"$n $filename" into this file (where $n is an ever-increasing number), 
wait a few seconds (sleep 2), and then run "import -w root -crop ..." to 
capture the screen and crop out the part you want.


This will work for the formats supported by ADXV, but obviously other 
formats will need another program.  The central problem is that every 
program (ADXV, MOSFLM, HKL, D*trek, etc.) has different ways of crushing 
the 16-bit pixels into 8 bits for the display, and we all have our 
"favorite" (the one that we think makes weak spots show up better), but 
almost none of the GUI displays have command-line-with-options 
equivalents.  ImageMagick has enough features that you can usually 
figure out how to "replicate" a given display program's algorithm, but 
some file formats (like the "packed" Mar files) will never be readable 
by ImageMagick.


It is perhaps worth pointing out that the "ADSC format" is actually 
called "SMV" since this file format was originally created about 30 
years ago for a program called "Super Marty View", (written by Martin 
Stanton, now at SomaLogic).  It has evolved somewhat since then.  The 
taxonomy of image file formats is something of a hobby of mine.  There 
seems to be no less than a hundred different species of them floating 
around in the world. Some are rare, some are locally prevalent, but they 
appear to all be highly territorial and you will almost never find more 
than one varietal populating a given lab, synchrotron or even a given 
country.  Someday I hope to collect specimens of each and every one of 
them (perhaps even filling out the "fossil record" or history of 
different beamlines and detectors) but documentation and particularly 
"example lysozyme datasets" are surprisingly hard to come by.  For 
example, I once had a crinkly old paper document that defined the 
"R-axis format", but recent sitings of files from R-axis detectors seem 
to be a new species descended from an SMV-like ancestor, and yet nowhere 
on the Rigaku website is there a document describing this new format, 
much less an example.  Most crystallographers do not have "good" data 
sets on hand (it is the bad ones that stay on disk forever), and many 
beamline scientists do not have any "test" data sets available either 
(for some reason).  Currently, my meager "museum" is here:

http://bl831.als.lbl.gov/example_data_sets/
If anyone would care to donate, I prefer data sets that are "easy" to 
process and that have anomalous differences (to clarify the hand of the 
spindle), but in cases where I have no examples, any data set will do.


-James Holton
MAD Scientist


Andy Torelli wrote:

Hi everyone,

Is there a free utility that can convert an x-ray diffraction 
image collected with an ADSC detector to a standard image file format 
e.g. .jpg, png, etc.?  I'm looking for something more elegant than a 
screen-capture that will yield a higher (graphics) resolution image. 
I'm sure someone must have done thi

Re: [ccp4bb] X-ray diffraction image --> .jpg

2009-10-21 Thread Nicholas K. Sauter

Andy,

Why not try labelit.png   [-large]?

Labelit is availale at http://cci.lbl.gov/labelit

Nick Sauter

On 10/21/2009 7:53 AM, Andy Torelli wrote:

Hi everyone,

Is there a free utility that can convert an x-ray diffraction 
image collected with an ADSC detector to a standard image file format 
e.g. .jpg, png, etc.?  I'm looking for something more elegant than a 
screen-capture that will yield a higher (graphics) resolution image. 
I'm sure someone must have done this, but I haven't been able to find 
one.



Thanks,
Andy Torelli


Re: [ccp4bb] X-ray diffraction image --> .jpg

2009-10-21 Thread Jim Pflugrath
A JPEG has fixed colors for the pixel values.  A diffraction image has to
use a viewer to convert the pixel values (counts) to a color.
One problem with just using a converter to jpeg is how to convert
intensities to color (i.e. computer display values).

A demo version of d*TREK is freely available.  It contains dtdisplay which
can display most known diffraction image formats (including Rigaku and ADSC)
and allow you to get what you want to see.  Then you can use a screen
capture.

I guess that one should have an option to output a TIFF or JPEG in
full-resolution of the detector for use with pixel peeping photo programs
like Photoshop.  There has not been much demand for such a program, but
maybe times have changed.

Jim

-Original Message-
From: CCP4 bulletin board [mailto:ccp...@jiscmail.ac.uk] On Behalf Of Andy
Torelli
Sent: Wednesday, October 21, 2009 9:53 AM
To: CCP4BB@JISCMAIL.AC.UK
Subject: [ccp4bb] X-ray diffraction image --> .jpg

Hi everyone,

Is there a free utility that can convert an x-ray diffraction image
collected with an ADSC detector to a standard image file format e.g. 
.jpg, png, etc.?  I'm looking for something more elegant than a
screen-capture that will yield a higher (graphics) resolution image. 
I'm sure someone must have done this, but I haven't been able to find one.


Thanks,
Andy Torelli


Re: [ccp4bb] X-ray diffraction image --> .jpg

2009-10-21 Thread Luis Mauricio Trambaioli da Rocha e Lima
Try MarView: http://www.marresearch.com/download.html#Utilities

   I use the Linux_glibc-2.3.3 (RedHat9, WS3, etc).
   Just download it, unpack (gunzip marView.gz)

# chmod a+x marView

a) to run the program from terminal
# ./marView or

# kate .bashrc:
alias marview=/home/user/Desktop/marview/./marView

b) alternativelly, place the program in the Desktop and just
double-click to start it up.

Mauricio




On Wed, Oct 21, 2009 at 12:53 PM, Andy Torelli  wrote:
> Hi everyone,
>
>        Is there a free utility that can convert an x-ray diffraction image
> collected with an ADSC detector to a standard image file format e.g. .jpg,
> png, etc.?  I'm looking for something more elegant than a screen-capture
> that will yield a higher (graphics) resolution image. I'm sure someone must
> have done this, but I haven't been able to find one.
>
>
> Thanks,
> Andy Torelli
>


Re: [ccp4bb] X-ray diffraction image --> .jpg

2009-10-21 Thread Harry

Hi

Mosflm has done this for years - there's a recipe on the Mosflm FAQ  
pages (well, the questions were asked frequently when I originally  
wrote them about 7 or 8 year ago!). Someone called Graeme Winter (now  
at Diamond) wrote this code originally...)



On 21 Oct 2009, at 15:53, Andy Torelli wrote:


Hi everyone,

	Is there a free utility that can convert an x-ray diffraction image  
collected with an ADSC detector to a standard image file format  
e.g. .jpg, png, etc.?  I'm looking for something more elegant than a  
screen-capture that will yield a higher (graphics) resolution image.  
I'm sure someone must have done this, but I haven't been able to  
find one.



Thanks,
Andy Torelli


Harry
--
Dr Harry Powell, MRC Laboratory of Molecular Biology, MRC Centre,  
Hills Road, Cambridge, CB2 0QH


Re: [ccp4bb] X-ray diffraction image --> .jpg

2009-10-21 Thread Graeme Winter
Hi Andy,

If you have a recent CCP4 installation (i.e. 6.something I think)
there's diff2jpeg, which does exactly what you want. Otherwise there
are also spells to use Mosflm for this which allows a little more
control over the greyscale settings.

Cheers,

Graeme

2009/10/21 Andy Torelli :
> Hi everyone,
>
>        Is there a free utility that can convert an x-ray diffraction image
> collected with an ADSC detector to a standard image file format e.g. .jpg,
> png, etc.?  I'm looking for something more elegant than a screen-capture
> that will yield a higher (graphics) resolution image. I'm sure someone must
> have done this, but I haven't been able to find one.
>
>
> Thanks,
> Andy Torelli
>