# Tools for tweaking stitching parameters

Stichit uses manually chosen stitching parameters to place tiles. This relies upon good alignment between the scan axes and the motion axes. It also requires a precise value for the number of microns per pixel. All of these things should be defined by the microscope producing the data. The values are read by StitchIt at tile load time and stitch time. To assist in setting these values at the microscope, StitchIt provides the function `chessboardStitch` and the associated viewer `exploreChessBoard`. They work roughly like this:

```
% Stitch physical section 2, optical plane 1, channel 1:
>> IM=chessboardStitch([3,1],1); % IM is a structure

% Now visualise this:
>> exploreChessBoard(IM) % (mouse wheel zooms, right-drag to pan )
>> exploreChessBoard(IM,2000) %Again but with a new threshold 

% Say we want to rotate the tiles by -0.4 degrees and compare 
% that with the original stitching:
>> IM(2) = IM;
% affineMatGen is in BakingTray
>> IM(2).params.affineMat = affineMatGen('rot', -0.4);
>> IM(2) = chessboardStitch([3,1],1,IM(2)); %To use new parameters


% Compare the two stitching results side by 
>> exploreChessBoard(IM,2000)
```

The above can be used to generate comparisons like this: ![](/files/-MUQV4dRwfw-ORGAc4j_)

Right is before and left is after tweaking.

## Also see

* <https://bakingtray.mouse.vision/getting-started/installation/calibration/example_stitching_correction_walkthrough>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://stitchit.mouse.vision/advanced-usage/tools-for-tweaking-stitching-parameters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
