How can I change the constraint of line profile?

两盒软妹~` 提交于 2019-12-24 05:53:32

问题


Is there any possibility to change the constraints of slices in a LinePlot display by script function?

In order to detach all lines I want, I currenlty have to click each line one-by-one and select the option from the menu.

I have not found such commands in the DM-script documentation. How can I do such a thing by script?


回答1:


The commands you seek are possibly described in the section on "LinePlotDisplays":

A quick example is:

image spectrum := RealImage( "Test", 4, 512 )
spectrum = icol * sin( icol/iwidth * 10 * Pi() ) 
spectrum.ShowImage()

imageDisplay disp = spectrum.ImageGetImageDisplay(0)
disp.LinePlotImageDisplaySetDoAutoSurvey( 0, 0 )            // Switch auto-survey off!
disp.LinePlotImageDisplaySetContrastLimits( -50, 100 )      // Set limits (uncalibrated)
disp.LinePlotImageDisplaySetDisplayedChannels( 100, 200 )   // Set X-range in display (uncalibrated)

However, if you are referring to the settings one gets from the right-click menu on the legend, i.e.

then, I'm afraid, I don't have any help for you.

It seems that no script access to this functionality exists in current DigitalMicrograph.

You can, however, "shift and scale" individual slices of a LinePlot with respect to each other by script commands. There is actually an example script in the help documentation, which I'm just copy-pasting here:

number deltaX = 10
number deltaY = 20

number kLinePlotType = 3
image spec := GetFrontImage()
if ( !spec.ImageIsValid() ) Throw( "Invalid image" )
if ( 0 == spec.ImageCountImageDisplays() ) Throw( "No Image Display" )

imageDisplay disp = spec.ImageGetImageDisplay(0)
if ( kLinePlotType != disp.ImageDisplayGetDisplayType() ) Throw( "Not a LinePlot." )

number nSlices = disp.LinePlotImageDisplayCountSlices()

// get current reference slice index and its ID
number refSlice_idx = disp.LinePlotImageDisplayGetSlice()
object slice_ref = disp.ImageDisplayGetSliceIDByIndex( refSlice_idx )

for ( number i = 1; i < nSlices; i++ )
{
    object slice_src = disp.ImageDisplayGetSliceIDByIndex( i )
    number int_offset, int_scale
    number pos_offset, pos_scale

    // get current transform factors between slice and reference slice
    disp.LinePlotImageDisplayGetImageToGroupTransform( slice_src, slice_ref, int_offset, int_scale, pos_offset, pos_scale )
    pos_offset = ( i / nSlices ) * deltaX
    int_offset = ( i / nSlices ) * deltaY

    // set new transform factors between slice and reference slice
    disp.LinePlotImageDisplaySetImageToGroupTransform( slice_src, slice_ref, int_offset, int_scale, pos_offset, pos_scale )
}


来源:https://stackoverflow.com/questions/44807390/how-can-i-change-the-constraint-of-line-profile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!